Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hello, I have a matrix in the rows, I have the names of the stations, in the columns I have the dates and in the values I have the quantity that is sold for each day. I would like to be able to order from highest to lowest on any date that I can sort by rows and by total quantity, but not by columns, they know how to do it.
Solved! Go to Solution.
Hi @Anonymous ,
If the date column is from your data table, you could create a custom column in Power Query, like below.
= Date.Year([Date])*10000
+ (12-Date.Month([Date]))*100
+ 31-Date.Day([Date])
If the date column is from the calendar table that you create with DAX, you could try like this:
Date =
VAR vCalendar =
CALENDAR ( MIN ( 'Table_Calendar'[Date] ), MAX ( 'Table_Calendar'[Date] ) )
RETURN
ADDCOLUMNS (
vCalendar,
"Index", YEAR ( [Date] )*10000
+ (12 - MONTH ( [Date] ))*100
+ 31 - DAY ( [Date] )
)
After creating the new column, select the date column and sort by the new one.
For more details, please see the attachment.
Create a desc rank and make it as sort for date and try
New Date = date
Rank =Rankx(all(date),Date[date],,desc,desnse)
Thanks amitchandak is what you need is to order only a date column for example if I want to order by date from highest to lowest by the quantity values for example sort the date 2020-01-02 by the quantity from highest to lowest. can this?
Hi @Anonymous ,
If the date column is from your data table, you could create a custom column in Power Query, like below.
= Date.Year([Date])*10000
+ (12-Date.Month([Date]))*100
+ 31-Date.Day([Date])
If the date column is from the calendar table that you create with DAX, you could try like this:
Date =
VAR vCalendar =
CALENDAR ( MIN ( 'Table_Calendar'[Date] ), MAX ( 'Table_Calendar'[Date] ) )
RETURN
ADDCOLUMNS (
vCalendar,
"Index", YEAR ( [Date] )*10000
+ (12 - MONTH ( [Date] ))*100
+ 31 - DAY ( [Date] )
)
After creating the new column, select the date column and sort by the new one.
For more details, please see the attachment.
User | Count |
---|---|
102 | |
90 | |
80 | |
71 | |
70 |
User | Count |
---|---|
114 | |
100 | |
97 | |
72 | |
68 |