cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ioanik
Frequent Visitor

How to reference a COLUMN used as slicer in order to use it inside a MEASURE

Hello Community,

Is there a way to reference THE COLUMN NAME of the slicer (in the form "Table"[Column]) inside of a measure ?

The reason I need this is because I want to have a different TITLE for the slicer visual, which will differ, depending on the column selected. And in order to get that, I need to use a FORMULA (measure) in the TITLE section which handles the title output depending on the column. But I can't reference it in any way. Sadly there is no ISSELECTED for columns, and I need  to find an alternative. And it also has to work without a selected value necessarily (so SELECTEDVALUE("Table"[Column]) command is also no good).

The title needs to be different then the column selected, because all these slicer columns have an abstract naming (eg name_1, name_2 ), used to avoid breaking the model upon online refreshing. The actual names are created by users and can be anything really and may be subject to change. This will be outputed by the dynamic title created from the measure, but this is the easier part.

So in other words I am looking for something like :
  Measure Title = IF(...SELECTEDCOLUMNOFSLICER(Table[name_1]) = TRUE ... ,"value1",
                                 IF(...SELECTEDCOLUMNOFSLICER(Table[name_2]) = TRUE ... ,"value2")
                             )

Thank you for your time on this,

Kind regards,

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @ioanik ,

 


1. the measure using the ISFILTERED expression doesn't work correctly, unless I actually choose a filter on the slicer visual, while I need it to work even if the user does not click on any value of the slicer.

 


For nothing selected, you can try to use:

IF ( ISBLANK ( SELECTEDVALUE ( 'Table'[Column] ) ), "xxx" )

 

 



2. when using the same measure as the TITLE formula, it does not even apply the naming conversion when filtered (meaning it doesn't recognise the FILTER applied).

 


This is by design.

 

 

Best Regards,

Icey

 

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

View solution in original post

4 REPLIES 4
ioanik
Frequent Visitor

Thank you @Icey ,

 

Yes it makes sense to not work if its by design, but I don't understand why they implemented it like this. I will surely propose an idea to change this.

For now I am accepting this as a solution since there is no way around this.

Kind regards

ioanik
Frequent Visitor

Hello @ERD and thank you for your quick response,

Unfortunately, i've already tried ISFILTERED, but there are two issues.

1. the measure using the ISFILTERED expression doesn't work correctly, unless I actually choose a filter on the slicer visual, while I need it to work even if the user does not click on any value of the slicer.

2. when using the same measure as the TITLE formula, it does not even apply the naming conversion when filtered (meaning it doesn't recognise the FILTER applied).

Im snipping two visuals (a. a card containing the measure and b. a slicer with the measure as a header and the column cluster_c1 as the slicer attribute), illustrating this behavior. Please ignore the comments, I just have to make this work for the values showing and then everything will work accordingly.issue_pb.JPG

 

Icey
Community Support
Community Support

Hi @ioanik ,

 


1. the measure using the ISFILTERED expression doesn't work correctly, unless I actually choose a filter on the slicer visual, while I need it to work even if the user does not click on any value of the slicer.

 


For nothing selected, you can try to use:

IF ( ISBLANK ( SELECTEDVALUE ( 'Table'[Column] ) ), "xxx" )

 

 



2. when using the same measure as the TITLE formula, it does not even apply the naming conversion when filtered (meaning it doesn't recognise the FILTER applied).

 


This is by design.

 

 

Best Regards,

Icey

 

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

ERD
Memorable Member
Memorable Member

@ioanik , you can use ISFILTERED function.

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

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

Stand with Ukraine!

Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

Helpful resources

Announcements
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

Thank you 2022 Review

2022 Monthly Feature Releases

We had a great 2022 with a ton of feature releases to help you drive a data culture.

Top Solution Authors
Top Kudoed Authors