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

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!

5 REPLIES 5
Community Support Team
Community Support Team

Re: Ignoring the legend filter effect on a measure

Hi @jkoch,

 

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 other members find it more quickly.
jkoch Frequent Visitor
Frequent Visitor

Re: Ignoring the legend filter effect on a measure

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

Community Support Team
Community Support Team

Re: Ignoring the legend filter effect on a measure

Hi @jkoch,

 

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 other members find it more quickly.
jkoch Frequent Visitor
Frequent Visitor

Re: Ignoring the legend filter effect on a measure

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

/Johannes

jkoch Frequent Visitor
Frequent Visitor

Re: Ignoring the legend filter effect on a measure

@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