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
Anonymous
Not applicable

Ignoring the legend filter effect on a measure

Hi, 

 

I have been trying to solve this for quite a while now and can't seem to find the solution on the forums as well. Hopefully some of you have encountered it and know how to solve it:

 

Goal: Hide measure (i.e., total stacked bar) if total number of answers relating to a question are below a certain number, while still seeing the measure for each legend. Of course it should allow outer slicers and filters to have been applied to the visual. 

 

q_pbi_1.png

As you can see, the countAnswersMeasure is different depending on the context, as it is 29 in the tooltip, and 63 "outside". If i do an adjustment to the measure:

countAnswersMeasure = IF(COUNT(Answers[answerValue]) > 19, COUNT(Answers[answerValue]), BLANK()) 

it will remove those blocks where the count falls below 20 within each legend category, but I want it kept as long as the total is 20 or above. I guess there is a DAX solution, but I can't figure it out. Please help!


I have a table like this, which I need to keep as such to allow for highly dynamic data in forms of handling new type of questions and responses:

 

q_pbi_2.png

 

Thanks!

6 REPLIES 6
v-frfei-msft
Community Support
Community Support

Hi @Anonymous,

 

I made one sample for your reference.  If I misunderstood your requirement, kindly share your excepted result and pbix to me.

 

1. Create a slicer based onAnswers[answerValue]

2. Create a measure as below.

 

countAnswersMeasure = 
IF (
    ISFILTERED ( Answers[answerValue] ),
    COUNT ( Answers[answerValue] ),
    IF (
        COUNT ( Answers[answerValue] ) > 1,
        COUNT ( Answers[answerValue] ),
        BLANK ()
    )
)

Capture.PNG

 

For more details, please check the pbix as attached.

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Anonymous
Not applicable

Hi @v-frfei-msft and thank you for your reply!

 

Unfortunately it wasn't exactly what I wanted. 


I believe I was a bit unclear when I described my problem, so I edited my original message. If you could read that again maybe you will understand. I also created a pbix file to show exactly what I want, I would be very happy if you could look at that! 

 

q_pbi_3.png


Best regards,

Johannes

Hi @Anonymous,

 

Please upload your file to onedrive and share the link here.

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Anonymous
Not applicable

@v-frfei-msft or anyone else who can help me.

I spent some more time on the problem but I still can't solve it. However I managed to narrow it down a bit:

1. I am using Hierarchy Slicer together with two measures that allows me to have AND logic between the attributes (following this guide)
2. One of these measures that is a 1/0 for each row messes with my attempts to only show the stacked bar plot if the total answers for each question is above a certain value. If I escape the filter context (i.e., the answerValue column as legend) using

countAnswersInQuestionMeasure = CALCULATE( COUNT( Answers[answerValue] ), ALL(Answers[answerValue]))

it also removes the HierarchySlicer Check filter. So I guess I need to remove the legend context while keeping the HierarchySlicer Check filter, but I can't get that to work. 

Here is an updated pbix file

Thanks!
Johannes

Anonymous
Not applicable

Just did! Edited my reply @v-frfei-msft

/Johannes

Hi, please did you manage to solve it? It's driving me crazy.

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.