How to sort by Columns in Matrix in Power BI without using measure
How can I sort by columns in Matrix in Power BI.
Let me explain a bit. I have this table (sample).
There is Unit and Rating (New Units will be always added often).
I try to show the data in Matrix in Power BI and I got this but I can't sort by High, Medium or Low at all.
I want to sort in this order (High Desc, Medium Desc and Low Dec) order.
How can I achieve it? I am quite new to Power BI.
sorting powerbi
add a comment |
How can I sort by columns in Matrix in Power BI.
Let me explain a bit. I have this table (sample).
There is Unit and Rating (New Units will be always added often).
I try to show the data in Matrix in Power BI and I got this but I can't sort by High, Medium or Low at all.
I want to sort in this order (High Desc, Medium Desc and Low Dec) order.
How can I achieve it? I am quite new to Power BI.
sorting powerbi
add a comment |
How can I sort by columns in Matrix in Power BI.
Let me explain a bit. I have this table (sample).
There is Unit and Rating (New Units will be always added often).
I try to show the data in Matrix in Power BI and I got this but I can't sort by High, Medium or Low at all.
I want to sort in this order (High Desc, Medium Desc and Low Dec) order.
How can I achieve it? I am quite new to Power BI.
sorting powerbi
How can I sort by columns in Matrix in Power BI.
Let me explain a bit. I have this table (sample).
There is Unit and Rating (New Units will be always added often).
I try to show the data in Matrix in Power BI and I got this but I can't sort by High, Medium or Low at all.
I want to sort in this order (High Desc, Medium Desc and Low Dec) order.
How can I achieve it? I am quite new to Power BI.
sorting powerbi
sorting powerbi
asked Nov 14 '18 at 16:19
kevinkevin
5,462236894
5,462236894
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
The trick is to create an order column and use that sort on with the Sort by Column feature.
The problem though is if you write a calculated column like this:
Order = SWITCH(Table1[Rate], "High", 1, "Medium", 2, "Low", 3)
and then try to sort on that, then you'll get a circular dependency error basically saying you can't sort by a column that is dependent on the column you are trying to sort.
There are a couple of workarounds.
One possibility is to create your order column in the query editor, which should be a simple custom column:
if [Rate] = "High" then 1
else if [Rate] = "Medium" then 2
else if [Rate] = "Low" then 3
else 0
Use this column to sort by.
Another possibility is to define a new table that with your ordering preference.
Enter Data:
Rate Order
-------------
High 1
Low 3
Medium 2
Call this table Sort
and create a relationship with the original table on the Rate
column.
Now create a calculated column on the original table that pulls over the Order
value.
Order = RELATED(Sort[Order])
Use this column to sort by.
it only sort from "High", "Low", "Medium" to "High","Medium", "Low". I want to sort the order of Unit by the descending High, descending Medium and decending Low too.
– kevin
Nov 14 '18 at 18:17
Click the ... on the visual and choose Sort by Count of Rate.
– Alexis Olson
Nov 14 '18 at 18:27
It sort by the Count of Rate but it is still not right for me. If Unit A has 10 Low Rating and Unit B has 1 High Rating. Unit A is shown above Unit B. I still want to show Unit B first since the rating is High although the count is just 1.
– kevin
Nov 27 '18 at 6:24
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53304592%2fhow-to-sort-by-columns-in-matrix-in-power-bi-without-using-measure%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The trick is to create an order column and use that sort on with the Sort by Column feature.
The problem though is if you write a calculated column like this:
Order = SWITCH(Table1[Rate], "High", 1, "Medium", 2, "Low", 3)
and then try to sort on that, then you'll get a circular dependency error basically saying you can't sort by a column that is dependent on the column you are trying to sort.
There are a couple of workarounds.
One possibility is to create your order column in the query editor, which should be a simple custom column:
if [Rate] = "High" then 1
else if [Rate] = "Medium" then 2
else if [Rate] = "Low" then 3
else 0
Use this column to sort by.
Another possibility is to define a new table that with your ordering preference.
Enter Data:
Rate Order
-------------
High 1
Low 3
Medium 2
Call this table Sort
and create a relationship with the original table on the Rate
column.
Now create a calculated column on the original table that pulls over the Order
value.
Order = RELATED(Sort[Order])
Use this column to sort by.
it only sort from "High", "Low", "Medium" to "High","Medium", "Low". I want to sort the order of Unit by the descending High, descending Medium and decending Low too.
– kevin
Nov 14 '18 at 18:17
Click the ... on the visual and choose Sort by Count of Rate.
– Alexis Olson
Nov 14 '18 at 18:27
It sort by the Count of Rate but it is still not right for me. If Unit A has 10 Low Rating and Unit B has 1 High Rating. Unit A is shown above Unit B. I still want to show Unit B first since the rating is High although the count is just 1.
– kevin
Nov 27 '18 at 6:24
add a comment |
The trick is to create an order column and use that sort on with the Sort by Column feature.
The problem though is if you write a calculated column like this:
Order = SWITCH(Table1[Rate], "High", 1, "Medium", 2, "Low", 3)
and then try to sort on that, then you'll get a circular dependency error basically saying you can't sort by a column that is dependent on the column you are trying to sort.
There are a couple of workarounds.
One possibility is to create your order column in the query editor, which should be a simple custom column:
if [Rate] = "High" then 1
else if [Rate] = "Medium" then 2
else if [Rate] = "Low" then 3
else 0
Use this column to sort by.
Another possibility is to define a new table that with your ordering preference.
Enter Data:
Rate Order
-------------
High 1
Low 3
Medium 2
Call this table Sort
and create a relationship with the original table on the Rate
column.
Now create a calculated column on the original table that pulls over the Order
value.
Order = RELATED(Sort[Order])
Use this column to sort by.
it only sort from "High", "Low", "Medium" to "High","Medium", "Low". I want to sort the order of Unit by the descending High, descending Medium and decending Low too.
– kevin
Nov 14 '18 at 18:17
Click the ... on the visual and choose Sort by Count of Rate.
– Alexis Olson
Nov 14 '18 at 18:27
It sort by the Count of Rate but it is still not right for me. If Unit A has 10 Low Rating and Unit B has 1 High Rating. Unit A is shown above Unit B. I still want to show Unit B first since the rating is High although the count is just 1.
– kevin
Nov 27 '18 at 6:24
add a comment |
The trick is to create an order column and use that sort on with the Sort by Column feature.
The problem though is if you write a calculated column like this:
Order = SWITCH(Table1[Rate], "High", 1, "Medium", 2, "Low", 3)
and then try to sort on that, then you'll get a circular dependency error basically saying you can't sort by a column that is dependent on the column you are trying to sort.
There are a couple of workarounds.
One possibility is to create your order column in the query editor, which should be a simple custom column:
if [Rate] = "High" then 1
else if [Rate] = "Medium" then 2
else if [Rate] = "Low" then 3
else 0
Use this column to sort by.
Another possibility is to define a new table that with your ordering preference.
Enter Data:
Rate Order
-------------
High 1
Low 3
Medium 2
Call this table Sort
and create a relationship with the original table on the Rate
column.
Now create a calculated column on the original table that pulls over the Order
value.
Order = RELATED(Sort[Order])
Use this column to sort by.
The trick is to create an order column and use that sort on with the Sort by Column feature.
The problem though is if you write a calculated column like this:
Order = SWITCH(Table1[Rate], "High", 1, "Medium", 2, "Low", 3)
and then try to sort on that, then you'll get a circular dependency error basically saying you can't sort by a column that is dependent on the column you are trying to sort.
There are a couple of workarounds.
One possibility is to create your order column in the query editor, which should be a simple custom column:
if [Rate] = "High" then 1
else if [Rate] = "Medium" then 2
else if [Rate] = "Low" then 3
else 0
Use this column to sort by.
Another possibility is to define a new table that with your ordering preference.
Enter Data:
Rate Order
-------------
High 1
Low 3
Medium 2
Call this table Sort
and create a relationship with the original table on the Rate
column.
Now create a calculated column on the original table that pulls over the Order
value.
Order = RELATED(Sort[Order])
Use this column to sort by.
answered Nov 14 '18 at 17:44
Alexis OlsonAlexis Olson
14.1k21734
14.1k21734
it only sort from "High", "Low", "Medium" to "High","Medium", "Low". I want to sort the order of Unit by the descending High, descending Medium and decending Low too.
– kevin
Nov 14 '18 at 18:17
Click the ... on the visual and choose Sort by Count of Rate.
– Alexis Olson
Nov 14 '18 at 18:27
It sort by the Count of Rate but it is still not right for me. If Unit A has 10 Low Rating and Unit B has 1 High Rating. Unit A is shown above Unit B. I still want to show Unit B first since the rating is High although the count is just 1.
– kevin
Nov 27 '18 at 6:24
add a comment |
it only sort from "High", "Low", "Medium" to "High","Medium", "Low". I want to sort the order of Unit by the descending High, descending Medium and decending Low too.
– kevin
Nov 14 '18 at 18:17
Click the ... on the visual and choose Sort by Count of Rate.
– Alexis Olson
Nov 14 '18 at 18:27
It sort by the Count of Rate but it is still not right for me. If Unit A has 10 Low Rating and Unit B has 1 High Rating. Unit A is shown above Unit B. I still want to show Unit B first since the rating is High although the count is just 1.
– kevin
Nov 27 '18 at 6:24
it only sort from "High", "Low", "Medium" to "High","Medium", "Low". I want to sort the order of Unit by the descending High, descending Medium and decending Low too.
– kevin
Nov 14 '18 at 18:17
it only sort from "High", "Low", "Medium" to "High","Medium", "Low". I want to sort the order of Unit by the descending High, descending Medium and decending Low too.
– kevin
Nov 14 '18 at 18:17
Click the ... on the visual and choose Sort by Count of Rate.
– Alexis Olson
Nov 14 '18 at 18:27
Click the ... on the visual and choose Sort by Count of Rate.
– Alexis Olson
Nov 14 '18 at 18:27
It sort by the Count of Rate but it is still not right for me. If Unit A has 10 Low Rating and Unit B has 1 High Rating. Unit A is shown above Unit B. I still want to show Unit B first since the rating is High although the count is just 1.
– kevin
Nov 27 '18 at 6:24
It sort by the Count of Rate but it is still not right for me. If Unit A has 10 Low Rating and Unit B has 1 High Rating. Unit A is shown above Unit B. I still want to show Unit B first since the rating is High although the count is just 1.
– kevin
Nov 27 '18 at 6:24
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53304592%2fhow-to-sort-by-columns-in-matrix-in-power-bi-without-using-measure%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown