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

Rules for graph formatting not applied correctely

Hi all

 

I am applying a formatting rule to a visual (a combined bar and line chart) for which the bars have a conditional formatting: The bars should be in blue for values below or equal to a certain threshold and in red for values above it. However the threshold is not applied correctely. Precicely, my threshold is at 16.26%, however two of the bars have the wrong color even though they are above this value (17.26, 19.17%). Only the bar having a value of 21.22% appears in the correct color red. For all values above it also works perfetely fine.

 

No idea what is going wrong!!

Any idea?

 

Thanks 🙂

8 REPLIES 8
pi_eye
Resolver IV
Resolver IV

Hi Rebreg, can you share your DAX in each instance?

 

If you hover over the bars in the chart, what values do they give?

 

Pi

Anonymous
Not applicable

When i hover over the bars, thats when I see that the formatting is not applied correctly. Then it shows the values i mentioned above (17.26, 19.17%). And even though they should appear in red, they appear in blue.

The rule doesn't need any DAX, i put it here:

Rebreg_0-1670149089716.png

The measure I am visualizing as bars has the formula 

 

 

Data for bars = 
CALCULATE(
    COUNTROWS('datatable'),
    'datatable'[color] = "Red"
)/
COUNTROWS('datatable')

 

 

 

I am plotting it over another attribute of the data table (a customer key) on the x-axis.

 

Thanks for your help!

hi Rebreg

 

My german is not good, but I've noticed you've got different units for the tolerances. This could be confusing it - maybe this is the issue?

Prozent vs zahl

pi_eye_0-1670168609015.png

 

 

Pi

Anonymous
Not applicable

Ah I am sorry, I made an example just for this post where I was sloppy. In my plot all the units are the same (%) and the problem still occurs.

Hi - this is very strange. I was able to recreate the issue locally.

 

When I set the tolerances as % - the formatting in the chart is wrong:

pi_eye_1-1670318544858.png

 

pi_eye_2-1670318580451.png

 

 

However when I change it to Numbers  it starts to work:

pi_eye_0-1670318500605.png

 

 

 

I'm not sure why that is - I can only think it might be some sort of bug? Because the % values are accurate in the bars!

 

I used the same DAX, almost word for word

 

Data for bars =
CALCULATE(
    COUNTROWS('what if'),
    'what if'[Color] = "Red"
)/
COUNTROWS('what if')

 

Pi

 

 

@Anonymous , I have just figured it out!

 

According to the guidance, the % values in conditional formatting refer to the the bar's value as a percent of the overall range of bars

So it does not refer to the value of the individual bar itself.

Please refer to : https://learn.microsoft.com/en-us/power-bi/create-reports/desktop-conditional-table-formatting#color-by-rules

pi_eye_3-1670318850363.png

 

 

Unfortunately this is not intuitive, hopefully microsoft can make this clearer in future releases!

 

Pi

Anonymous
Not applicable

Haha woooow, thanks so much for the reserach! This is really not intuitive at all 😛 Thanks for the help!

Can this be placed somewhere as a change request?

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.