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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.