Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
Pic will make it clear :
What I wanted is Year-week in a descending order.
At leat putting Year-Month above is will get me the descending part because YM is sorted by YM- :
)
But for the weeks it is not fully working (but now at least 2025 comes first because of YM)
multiply by -1 is not an option I think because I use this to get the week numbers:
Solved! Go to Solution.
Hi @rpinxt
The matrix visual does not offer an option to sort columns in descending or ascending order directly. Columns are sorted either alphabetically or based on custom sorting in ascending order. To achieve your desired sorting, you will need to create a custom sort column. Please refer to the example below:
DatesTable =
VAR _base =
ADDCOLUMNS (
CALENDAR ( DATE ( 2024, 1, 1 ), TODAY () ),
"YYYY-MM", FORMAT ( [Date], "YYYY-MM" ),
"Year Week",
YEAR ( [Date] ) & "-"
& FORMAT ( WEEKNUM ( [Date] ), "00" )
)
RETURN
ADDCOLUMNS (
_base,
"Year-Month Sort", RANKX ( _base, [YYYY-MM],, DESC, DENSE ),
"Year-Week Sort", RANKX ( _base, [Year Week],, DESC, DENSE )
)
@danextian ah took only a tiny adjustment to make it all work as expected 😄
Now all is perfect. Thanks!
I think I understand a bit @danextian
My original Dim_Date table was connect to a table on rundate then from that connection it makes:
CALENDARAUTO relies on the existing dates in your model. I don't know what dates you have there. So when you use TODAY() in CALENDAR(), you're seeing week 2 since we already are in the second week of January. Instead of today, use MAX(data[rundate])
Thanks @danextian
Looks to be sorting but 2 major things:
Its january so it should be 2025-01 and not 02??
And were is suddenly week 50 and 47?? (and I have week 53 now)
Hi @rpinxt
The matrix visual does not offer an option to sort columns in descending or ascending order directly. Columns are sorted either alphabetically or based on custom sorting in ascending order. To achieve your desired sorting, you will need to create a custom sort column. Please refer to the example below:
DatesTable =
VAR _base =
ADDCOLUMNS (
CALENDAR ( DATE ( 2024, 1, 1 ), TODAY () ),
"YYYY-MM", FORMAT ( [Date], "YYYY-MM" ),
"Year Week",
YEAR ( [Date] ) & "-"
& FORMAT ( WEEKNUM ( [Date] ), "00" )
)
RETURN
ADDCOLUMNS (
_base,
"Year-Month Sort", RANKX ( _base, [YYYY-MM],, DESC, DENSE ),
"Year-Week Sort", RANKX ( _base, [Year Week],, DESC, DENSE )
)
User | Count |
---|---|
65 | |
60 | |
47 | |
33 | |
32 |
User | Count |
---|---|
85 | |
75 | |
56 | |
50 | |
45 |