Forum Discussion

diablo9083's avatar
diablo9083
Frequent Visitor
1 year ago

Column Reference From Field Parameter Slicer in DAX

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?

 

2 Replies