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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Irek
Helper II
Helper II

Hide bar when one of category value is smaller than..

Hello everyone, 

 

Need to add  logic that would make possible to hide Y axis category bar when one of the values in legend for this category is lower than for example 9. 

Irek_0-1712655362305.png

for example Canada , have 8 in blak category, so it should be hidden, whole Canada should be removed from chart, same Finlad and etc. 

 

I did some calculations but nothing seems to work so far. 

1 ACCEPTED SOLUTION

Hi @Irek 

 

Here's an example of what I did that might help you.

 

My sample:

vxuxinyimsft_0-1712817519036.png

 

Create several measures as follow

ForRank = SUM('Table'[Value])
rank = RANKX(ALLEXCEPT('Table', 'Table'[Country]), [ForRank], , ASC, Dense)
less = 
VAR _min = MINX(FILTER(ALL('Table'), [Value] < 3), [rank])
VAR _minValue = CALCULATE(MAX('Table'[Value]), FILTER(ALLEXCEPT('Table', 'Table'[Country]), [rank] = _min))
VAR _second = _min + 1
VAR _secondValue = CALCULATE(MAX('Table'[Value]), FILTER(ALLEXCEPT('Table', 'Table'[Country]), [rank] = _second))
RETURN
IF(MAX([Value]) = _minValue || MAX([Value]) = _secondValue, 0, 1)

 

Put the measure into the visual-level filters, set up show items when the value is 1.

vxuxinyimsft_1-1712817570954.png

 

Result:

vxuxinyimsft_2-1712817724733.png

 

Best Regards,
Yulia Xu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-xuxinyi-msft
Community Support
Community Support

Hi @Irek 

 

In order to better help you, I need to confirm your logic with you. According to your description, do you mean to hide the corresponding bar when the Values of any Legend is less than 9?

vxuxinyimsft_1-1712716539071.png

 

According to my judgment, in your diagram, the "Address" of each location is less than 9.

vxuxinyimsft_0-1712716521937.png

 

Here's the data I've restored so far. If this it is structurally different from the one you are using, please do not hesitate to mention it and I will modify it.

vxuxinyimsft_2-1712716678981.png

 

Best Regards,
Yulia Xu

I  have new requirment from client. Now I should hide only category that is smaller than 3, what is easy. 

Second part of request is harder for me , in case when one category is smaller than 3 , this category should be hidden and also second small category shoudl be hidden. 

 

 

For example Indonesia from chart picure i attached. 

It should have hidden Addreess beacuse it have 2 , Leap aslo 2 and Blank becuase is second small after this two. 

Hi @Irek 

 

Here's an example of what I did that might help you.

 

My sample:

vxuxinyimsft_0-1712817519036.png

 

Create several measures as follow

ForRank = SUM('Table'[Value])
rank = RANKX(ALLEXCEPT('Table', 'Table'[Country]), [ForRank], , ASC, Dense)
less = 
VAR _min = MINX(FILTER(ALL('Table'), [Value] < 3), [rank])
VAR _minValue = CALCULATE(MAX('Table'[Value]), FILTER(ALLEXCEPT('Table', 'Table'[Country]), [rank] = _min))
VAR _second = _min + 1
VAR _secondValue = CALCULATE(MAX('Table'[Value]), FILTER(ALLEXCEPT('Table', 'Table'[Country]), [rank] = _second))
RETURN
IF(MAX([Value]) = _minValue || MAX([Value]) = _secondValue, 0, 1)

 

Put the measure into the visual-level filters, set up show items when the value is 1.

vxuxinyimsft_1-1712817570954.png

 

Result:

vxuxinyimsft_2-1712817724733.png

 

Best Regards,
Yulia Xu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Yulia, 

 

Thank you again for your help, 
My data looks a little bit different than in example, i was sure that I will be able to change your calculation and use it but I'm starting to think i wont . 

Irek_0-1713170459940.png

 

Hi Yulia, 

 

yes, in my example "Adress" have less than 10 for all location, in "real" data it looks a little bit different. but for this task we can assume that minimal should be 3. Every country with value less than 3 for any category in legend should be hidden in visual. 

 

Thank you

Marcin

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.