Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
diablo9083
Frequent Visitor

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 2
Anonymous
Not applicable

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:

vlinhuizhmsft_0-1732867051784.png

 

In Power Query Editor,  unpivot the column:

vlinhuizhmsft_1-1732867129061.png

vlinhuizhmsft_2-1732867174480.png

 

The result is as follows:

vlinhuizhmsft_3-1732867240855.png

 

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.

Gabry
Super User
Super User

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors