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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Ang0zyx
Frequent Visitor

Field Parameter with ALLSELECTED/ALL/REMOVEFILTERS

Hi Everyone,

 

Could you please let me know if Field Parameter can be used inside ALLSELECTED/ALL/REMOVEFILTERS Functions.

The idea is to create a dynamic DAX, passing the slected column name from Field parameter to ALLSELECTED.

Example:
RANKX(ALLSELECTED( 'Table'[Column 1] ),[# of Quality Event])
We need to change the Column dynamically based on Field parameter selection. e.g if Column 2 is selected the Rankx will be calculated based on Column 2

4 REPLIES 4
v-yangliu-msft
Community Support
Community Support

Hi  @Ang0zyx ,

I created some data:

vyangliumsft_0-1658735932185.png

You can consider creating a table to act as a slicer, whichever is selected, whichever is the Rank

Here are the steps you can follow:

1. Use Enter data to create a table as a slicer.

vyangliumsft_1-1658735932187.png

2. Create measure.

Rank =
var _select=SELECTEDVALUE('Slicer_Table'[Slicer])
return
SWITCH(
    TRUE(),    MAX('Slicer_Table'[Slicer])="Column1",RANKX(ALLSELECTED('Table'),CALCULATE(MAX('Table'[Column1])),,ASC),
MAX('Slicer_Table'[Slicer])="Column2",RANKX(ALLSELECTED('Table'),CALCULATE(MAX('Table'[Column2])),,ASC))

3. Result:

Slicer select "Column1", sort by [Column1]

vyangliumsft_2-1658735932188.png

Slicer select "Column2", sort by [Column2]

vyangliumsft_3-1658735932189.png

If you need pbix, please click here.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Hi Yang,

We already have this solution implemented through Field Parameter. So wanted to know confirm if there is any other way to accomodate the Column name (selected in Field parameter) dynamically inside ALLSELECTED so that we dont have to write a SWITCH statement.

Was looking for the same answer. DId you ever find out if there is a way to do this?

lbendlin
Super User
Super User

Please provide a more detailed explanation of what you are aiming to achieve. What have you tried and where are you stuck?

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.