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
Oldnewbie
Frequent Visitor

Sort matrix/table by latest month column

Hi all,

 

I am trying to sort a table containing product production per month. I want the top row to have the product which was produced in largest amount in latest/current month. When I do traditional sort by column, I am getting rows sorted according to sum of values of all months. Is there any way to achieve desired output below?

Months are in one measure

 

Data:

ProductOctNovDecJan
A2622
B3214
C2412

 

Desired output:

ProductOctNovDecJan
B3214
A2622
C2411
1 ACCEPTED SOLUTION
negi007
Community Champion
Community Champion

@Oldnewbie  in this case you can achieve it by creating a calcualted table like below. You can apply year and month filter based on the current date and make filter dynamic as well.

 

in this case i have order table which has transactional level data for each product and its category. from this table i have creted a summarize table like below

 

Table_Product_rank = SUMMARIZECOLUMNS(Orders[Product Category],FILTER('Calendar',YEAR('Calendar'[Date].[Year]=2022)),FILTER('Calendar','Calendar'[Month#]="12"),"Sales",SUM(Orders[Sales]))
 
then added rank calc column in this table
Rank = RANK.EQ(Table_Product_rank[Sales],Table_Product_rank[Sales],DESC)
 
this table will alwasy be sorted based on the latest month volume like below
negi007_0-1674023432900.png

 

you can sort the above table on the rank category

 

then you can link this table to your main order table,

 

negi007_1-1674023496932.png

 

then in your matrix visual you can use the category from the newly created table and data will be sorted based on the data in the new table.

 

negi007_2-1674023544511.png

have attached the pbix file as well.

 




Did I answer your question? Mark my post as a solution!
Appreciate your Kudos



Proud to be a Super User!


Follow me on linkedin

View solution in original post

2 REPLIES 2
rupeshjiwtode
Regular Visitor

My requirement to make dynamic...

 you have to use year = 2022 and month = 12 

 

Can you please elaborate this and suggest solution.

 

Thanks in advance

negi007
Community Champion
Community Champion

@Oldnewbie  in this case you can achieve it by creating a calcualted table like below. You can apply year and month filter based on the current date and make filter dynamic as well.

 

in this case i have order table which has transactional level data for each product and its category. from this table i have creted a summarize table like below

 

Table_Product_rank = SUMMARIZECOLUMNS(Orders[Product Category],FILTER('Calendar',YEAR('Calendar'[Date].[Year]=2022)),FILTER('Calendar','Calendar'[Month#]="12"),"Sales",SUM(Orders[Sales]))
 
then added rank calc column in this table
Rank = RANK.EQ(Table_Product_rank[Sales],Table_Product_rank[Sales],DESC)
 
this table will alwasy be sorted based on the latest month volume like below
negi007_0-1674023432900.png

 

you can sort the above table on the rank category

 

then you can link this table to your main order table,

 

negi007_1-1674023496932.png

 

then in your matrix visual you can use the category from the newly created table and data will be sorted based on the data in the new table.

 

negi007_2-1674023544511.png

have attached the pbix file as well.

 




Did I answer your question? Mark my post as a solution!
Appreciate your Kudos



Proud to be a Super User!


Follow me on linkedin

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.