Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount.
Register nowThe 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.
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 Number | Group | Change to last Invoice |
1234 | 1 | 0.005 |
1234 | 2 | 0.005 |
1234 | 3 | 0.005 |
9876 | 1 | -0.02 |
9876 | 1 | -0.02 |
9876 | 2 | -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)
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:
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:
Any ideas? I'm really confused here.
Thank you very much
Solved! Go to Solution.
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.
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.
User | Count |
---|---|
123 | |
69 | |
67 | |
58 | |
52 |
User | Count |
---|---|
185 | |
92 | |
67 | |
62 | |
52 |