cancel
Showing results 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

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.

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
Community Support

Hi @Irek

My sample:

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.

Result:

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.

5 REPLIES 5
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?

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

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.

Best Regards,
Yulia Xu

Helper II

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.

Community Support

Hi @Irek

My sample:

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.

Result:

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.

Helper II

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 .

Helper II

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

Announcements

#### 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 Monthly Update - June 2024

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

#### 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
Top Kudoed Authors