March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
I'm trying to custom rank a selected column from a slicer. Below works with the fully qualified column name.
MeasureBinSort = SWITCH(MAX('Turnaround'[Order Time to Begin Time (bins)]),
"x <= 30", 1,
"30 < x <= 60", 2,
"60 < x <= 90", 3,
"90 < x <= 120", 4,
"120 < x <= 150", 5,
"150 < x <= 180", 6,
"180 < x <= 210", 7,
"210 < x <= 240", 8,
"240 < x <= 270", 9,
"270 < x <= 300", 10,
"300 < x", 11
)
'Turnaround'[Order Time to Begin Time (bins)] exists as a selection in a field parameter slicer found in 'Measure Slicer'[Measure Slicer Fields] in the form of NAMEOF('Turnaround'[Order Time to Begin Time (bins)])
I want to update the above measure to use any selected column from that field parameter slicer. All of the columns that can be selected use the same values seen above, so they should all be ranked the same.
I tried this, and DAX says the MAX function only accepts a column reference as an argument:
MeasureBinSort = SWITCH(MAX(SELECTEDVALUE('Measure Slicer'[Measure Slicer Fields])),
"x <= 30", 1,
"30 < x <= 60", 2,
"60 < x <= 90", 3,
"90 < x <= 120", 4,
"120 < x <= 150", 5,
"150 < x <= 180", 6,
"180 < x <= 210", 7,
"210 < x <= 240", 8,
"240 < x <= 270", 9,
"270 < x <= 300", 10,
"300 < x", 11
)
I feel like I'm close, but just can't cross the finish line. Does anyone have any ideas?
Thanks for the reply from Gabry.
Hi @diablo9083 ,
This error occurs because SELECTEDVALUE returns a single value instead of a column reference, it is recommended that you use the slicer directly.
Here is the test data I created:
In Power Query Editor, unpivot the column:
The result is as follows:
Best Regards,
Zhu
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
86 | |
77 | |
57 | |
52 |
User | Count |
---|---|
201 | |
137 | |
108 | |
73 | |
68 |