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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
bckrmx
Regular Visitor

Conditional formatting Card - Callout value - negative numbers are ignored

Hi

 

I'm having problems with formatting a datacard value conditionally. I want to have the font in red, if the number is negative and green if it's positive. Hoped it would be a simpler matter 🙂

 

Anyway, the underlying data roughly looks as follows:

 

Invoice NumberGroupChange to last Invoice
123410.005
123420.005
123430.005
98761-0.02
98761-0.02
98762-0.02

 

As you see, I have a multi-indexed table (if that's important). But the group in this specific case is of no matter, since the change refers to the invoice anyway. This is the data I get from the database and I can not normalize it further for other purposes.

 

Anyhow, I drill-through the page using an Invoice number and want one change value in the datacard. This is naturally achieved with any aggregation function since it yields the same result anyway. I'm using max in my exampe (but my problem occurs with min/max/sum/avg etc. too)

 

bckrmx_0-1668192694935.png

The "change" column in the query editor is formatted to decimal and in the data tab of the editor I formatted it further to percentage (already formatting it into percentage in the query editor doesn't change the error unfortunately)

 

I tried every possible permutation in the image above. I also tried:

  • Green
    • If value >= MIN and < 1000
    • if value >=0 and < 1000
  • Red
    • if value >= Min and <= 0
    • if value >= -1000 and <= 0

And various other possibilities, all to no avail.

As you see in the image above, I tried working with decimal points, since I thought maybe the numbers are rounded somwhere in the background. Since the original underlying data is 0.05 for 5% for example, but that didn't work either.

What makes me doubt it could be a problem with the number formatting or anything is, that the conditional formatting works when it's a table:

 

bckrmx_1-1668193334231.png

 

Any ideas? I'm really confused here.

 

Thank you very much

1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @bckrmx 

Thanks for reaching out to us.

you can create a measure used for conditional formatting,  refer to 

Solved: Conditional Formatting based on calculated measure - Microsoft Power BI Community

Measure = 
var V=CALCULATE(SUM('Table'[Value]))
return IF(V>R[R Value],"#FD625E",
            IF(V>[A Value]&&V<R[R Value],"#F2C80F",
                IF(V>G[G Value]&&V<R[R Value],"#01B8AA")))

if you need more help, please share a sample file.

 

 

Best Regards,

Community Support Team _Tang

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

View solution in original post

1 REPLY 1
v-xiaotang
Community Support
Community Support

Hi @bckrmx 

Thanks for reaching out to us.

you can create a measure used for conditional formatting,  refer to 

Solved: Conditional Formatting based on calculated measure - Microsoft Power BI Community

Measure = 
var V=CALCULATE(SUM('Table'[Value]))
return IF(V>R[R Value],"#FD625E",
            IF(V>[A Value]&&V<R[R Value],"#F2C80F",
                IF(V>G[G Value]&&V<R[R Value],"#01B8AA")))

if you need more help, please share a sample file.

 

 

Best Regards,

Community Support Team _Tang

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

Helpful resources

Announcements
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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