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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
Atlsql
Frequent Visitor

Conditional Formatting / Data Type.

We have a dashboard with conditional formatting on a value.  

< 4.70 the cell turns yellow. 

>= 4.70 the cell turns light green. 

 

The expression that is evaluated is SumOfScore ( Decimal ) / CountOfScores ( Int ). 

The oddity is that at the value of 4.7 ( 84.6 / 18 ) the cell is being colored yellow.


I came up with a work around - but I'd love to understand why if someone knows.  I suspect that it has something to do with the data types, but with a value that Excel says is 4.7000000000 I'm at a loss as to why PowerBI is evaluating that as something less then 4.7.

 

Turns Cell Yellow

msNameOfMeasure =
var TotalScores = Calculate(SUM(FactTable[TotalScore]))
var CountofScores = Calculate(SUM(FactTable[CountOfSCores]))
return TotalScores / CountofScores
 
Turns Cell Green ( As designed )
msNameOfMeasure =
var TotalScores = Convert(Calculate(SUM(FactTable[TotalScore])), CURRENCY)
var CountofScores = Convert(Calculate(SUM(FactTable[CountOfSCores])), DOUBLE)
return TotalScores / CountofScores
 
1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

Decimal numbers are always approximations. Use ROUND etc to force the result of a division to snap to an integer.

View solution in original post

1 REPLY 1
lbendlin
Super User
Super User

Decimal numbers are always approximations. Use ROUND etc to force the result of a division to snap to an integer.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.