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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
AABright
Frequent Visitor

The IN operator finds all values within ALLSELECTED, even though slicers have been selected.

I am attempting to make a calculated column which creates a flag when a value in the table has been selected.

 

The filters are applied to a dimension table which is joined to my fact table on the Prime_ID.

You can see there are 25 matches betweent those two tables, in this example with certain slicers selected.

IDs in both tables.png

 

But when I write the DAX to flag the Prime_ID if it is among the selected values, they all result in "selected".

I have tried writing this using containsrow, but the result is the same.

DAX and results.png

 

4 REPLIES 4
AABright
Frequent Visitor

@talespin  How do you recommend I do that?

I need a dynamic flag which updates according to the slicer selections. 

I will then use that flag in the partitionby clause of a rownumber function. (the row numbers will be used to calculate decile rankings, but that is down the line. And I'm currently stuck at square one)

hi @AABright 

 

I am not sure if you need to be at square one, there might be better approach to doing what you want to do, since we do not have any detail on your requirement, so here is my try to address square one.

 

You see Dim and Orders table linked on code(Integer field).

talespin_0-1711968597151.png

Slicer contains code from Dim table and Table visual contains all attributes from Orders table.

 

Create this measure

---------------------------------------------------------------

IsSelected =
VAR _SlicerValues = ALLSELECTED(Orders[code])
VAR _SelectedCode = SELECTEDVALUE(Orders[code])
RETURN IF( _SelectedCode IN _SlicerValues, "Selected", "Not Selected")
---------------------------------------------------------------
 

talespin_1-1711968813510.png

 

That worked great to create the flag. Thanks @talespin

Unfortunately my plan to drop that result into the partitionby clause of a rownumber function does not work. It looks like you cannot reference a calculated measure there.

 

I am going to write a new question on how to create dynamic decile ranking. My research for that hasn't been fruitful.

talespin
Solution Sage
Solution Sage

hi @AABright 

 

"I am attempting to make a calculated column which creates a flag when a value in the table has been selected."

 

This is not possible, Calculated colums are refreshed during report refresh and are not influenced by slicers. You need to create measure.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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