Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
12Bowers12
Helper V
Helper V

the column arranged in matrix from 1 Month to 12 Months order

Hello everyone,

I have a calculated column to group days to 12 months as shown below. 

In the matrix, colomn [Month Group] functions as Columns. Logically, the colum in the matrix should be ranked from 1M to 12 M. However, the colum shows  the order as 1M, 10 M, 11M, 12M, then 2M to 9M. 

Any ideas to arrange the column from 1M to 12M?

Thank you.

Dennis

 

Month Group =
SWITCH(  TRUE(),
Loss[Days Claim] <=30, "1 M",
Loss[Days Claim] <=60, "2 M",
Loss[Days Claim] <=90, "3 M",
Loss[Days Claim] <=120, "4 M",
Loss[Days Claim] <=150, "5 M",
Loss[Days Claim] <=180, "6 M",
Loss[Days Claim] <=210, "7 M",
Loss[Days Claim] <=240, "8 M",
Loss[Days Claim] <=270, "9 M",
Loss[Days Claim] <=300, "10 M",
Loss[Days Claim] <=330, "11 M",
"12 M" )
3 ACCEPTED SOLUTIONS
TheoC
Super User
Super User

@12Bowers12 in Power Query, create a Conditional Column that applies the same logic as the Month Group column but give it a value starting at 1 through to 12... Ensure it's a whole number and then when you Close & Apply, you can use the new column as the Sort by Column over the Month Group column.

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

View solution in original post

Shishir22
Solution Sage
Solution Sage

Hi @12Bowers12 

 

Create one more calculated column as

 

 

Month Group Sort=
SWITCH(  TRUE(),
Loss[Days Claim] <=30, 1,
Loss[Days Claim] <=60, 2,
Loss[Days Claim] <=90, 3,
Loss[Days Claim] <=120, 4,
Loss[Days Claim] <=150, 5,
Loss[Days Claim] <=180, 6,
Loss[Days Claim] <=210, 7,
Loss[Days Claim] <=240, 8,
Loss[Days Claim] <=270, 9,
Loss[Days Claim] <=300, 10,
Loss[Days Claim] <=330, 11,
12)
 
Click on Month Group Calculated column. 
Click on SortBy. 
And select Month Group Sort.
 
Please mark this reply as solution if it fulfils your requirement. Kudos are also accepted.
Cheers! 
Cheers,
Shishir

View solution in original post

CNENFRNL
Community Champion
Community Champion

Month Group = CEILING( Loss[Days Claim]/30, 1 ) & " M"

Screenshot 2021-09-30 061950.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

8 REPLIES 8
CNENFRNL
Community Champion
Community Champion

Month Group = CEILING( Loss[Days Claim]/30, 1 ) & " M"

Screenshot 2021-09-30 061950.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Thank you, CNENFRNL.

Thank both of you, the two solutions work perfectly.

@CNENFRNL This is awesome! Tried to ❤ but only had 👍 available lol

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Shishir22
Solution Sage
Solution Sage

Hi @12Bowers12 

 

Create one more calculated column as

 

 

Month Group Sort=
SWITCH(  TRUE(),
Loss[Days Claim] <=30, 1,
Loss[Days Claim] <=60, 2,
Loss[Days Claim] <=90, 3,
Loss[Days Claim] <=120, 4,
Loss[Days Claim] <=150, 5,
Loss[Days Claim] <=180, 6,
Loss[Days Claim] <=210, 7,
Loss[Days Claim] <=240, 8,
Loss[Days Claim] <=270, 9,
Loss[Days Claim] <=300, 10,
Loss[Days Claim] <=330, 11,
12)
 
Click on Month Group Calculated column. 
Click on SortBy. 
And select Month Group Sort.
 
Please mark this reply as solution if it fulfils your requirement. Kudos are also accepted.
Cheers! 
Cheers,
Shishir
TheoC
Super User
Super User

@12Bowers12 in Power Query, create a Conditional Column that applies the same logic as the Month Group column but give it a value starting at 1 through to 12... Ensure it's a whole number and then when you Close & Apply, you can use the new column as the Sort by Column over the Month Group column.

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

TheoC
Super User
Super User

@12Bowers12 can you use "Days Claim" value to sort "Month Group" which is under the Column Tools ribbon (the "Sort by Column" button)?

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Thank you, TheoC,

The message 'Sprt by another column' says:

We can't sort the 'Months Claim' column by 'Days Claim'. There can't be more than one value in 'Days Claim' for the same value in 'Months Claim'.

Any ideas?

Dennis

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.