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

Be 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

Reply
diablo9083
Regular 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
v-linhuizh-msft
Community Support
Community Support

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.