Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Conditional Formatting Bug

Hey guys,   I have column in a table which is conditonally formated based on a column named "D_CurrentStatusLightsColor", this always worked, but suddenly, some of the fields are white instead of t...
  • edhans's avatar
    edhans
    6 years ago

    This is not a bug, this is how Power BI works. Here is what is happening:

    • Your margin field, for example, has no data. So you tell it to show items with no data. This is one reason I don't use fields for values in visuals. Always use explict measures. SUM(Table[Margins]) for example. Still returns blanks. I'll get to that.
    • Your conditional formatting isn't formatting the current Status field based on the color field. It is formatting it based on the FIRST() value of the color field. But you have no data, so even if you show the items with no data, the measure Power BI using in the background is returning no records, so there is no FIRST(colorfield) returned.
    • The fix is to use an explicit measure like the following:

     

    New Margin = COALESCE( SUM('Table'[Margin]), 0)

     

    So if there is no margin, it returns zero. Then you get this table:

     

    If you don't want zeros in your table, you need to use custom formatting for the measures to return a visual blank. Use this format:

    #,##0;-#,##0;

    It is on the model view:

    Then you get this table: