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
PBNikr
Helper I
Helper I

Dynamic measure in card based on slicer value not working

I have already created the following measure which gives me True/False based on what value has been chosen in the slicer (only 2 values):

 

 

selected = HASONEVALUE('Text'[Text])

 

 

In the card I have the following measure. It should show a value if the slicer choice is False and 0 if the slicer value is true:

 

 

selectedValueCard = 
IF (
    'Text'[selected]=False,
    'Text'[My Data] ,
    0
)

 

 

Any idea why this isn't working? I currently get the value of 'Text'[My Data] no matter which slicer is chosen.

3 REPLIES 3
PBNikr
Helper I
Helper I

Here's a bit more information:

 

I am using a live connection to a cube. The slicer contains two different text choices, let's say A and B and this value comes from Dimension C. So I figured I could use "selected" to contain True or False depending on if A or B is chosen.

 

I then have "selectedValueCard" in the dimension where I have the measure I would like to show if A is selected and 0 if B is selected in the slicer.

 

I hope this made it a bit more clear. Sorry for the bad explaination - I'm new to Power BI!

v-yulgu-msft
Employee
Employee

Hi @PBNikr,

 

Below was the result I got based on the measures you provides. In my test, I suppose 'Text'[My Data]="Choose a value"

1.PNG2.PNG

The measure [selected] returns false if there is nothing selected in slicer, while returns true if you make a choice. 

 

For more advice, please share your sample data and post a screenshot of the unexpected result you have got.

 

Regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Stachu
Community Champion
Community Champion

is Text[selected] a calculated column? if so it will not relate to an slicer selection, it will just calculate the value per row
assuming in the slicer you filter Text[Text] and it's on the same table as Text[MyData], I would create following measure:

selectedValueCard = IF(HASONEVALUE(VALUES(Text[MyData])),VALUES(Text[MyData]),BLANK())

it assumues that slicer selection will always give single value from MyData



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

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.