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
elaj
Helper IV
Helper IV

Calculate a measure based on selectedvalue or other measure

I have a problem with a measure.
I need to change "cat_1" over another slicer.

 

Measure_1 = CALCULATE([Total], table[Category] == "cat_1")

 

This works... but is not flexible for my needs.
I know i could filter the whole visual over "cat_X"... and just use the [Total] measure, but it is not possible, because my axis shouldnt be filtered by that.
I tried to do this:

 

Measure_1 = CALCULATE([Total], table[Category] == SELECTEDVALUE(table[Category]))

 

Not possible... i dont know why... because SELECTEDVALUE(table[Category]) should return the string "cat_X"... and it does... inside of a card visual.
Even:

 

filter = "cat_1"
Measure_1 = CALCULATE([Total], table[Category] == filter)

 

is not working. I dont know why.
Do you know a solution?

1 ACCEPTED SOLUTION
elaj
Helper IV
Helper IV

Its weird... 

Measure_1 = 
VAR sel_value = SELECTEDVALUE(table[Category])
VAR result = CALCULATE([Total], table[Category] == sel_value )
RETURN
result

but this is working.

View solution in original post

1 REPLY 1
elaj
Helper IV
Helper IV

Its weird... 

Measure_1 = 
VAR sel_value = SELECTEDVALUE(table[Category])
VAR result = CALCULATE([Total], table[Category] == sel_value )
RETURN
result

but this is working.

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.