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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors