Forum Discussion

Kimber's avatar
Kimber
Helper III
1 year ago
Solved

Complex conditional formatting stopped working

Up until today, I've been using a field to conditionally format the callouts on card visuals. All of a sudden, although the formatting is still being applied correctly, I can't see the name of the field in the selection box. When I select the field from the dropdown, the dropdown goes blank immediately again. Even worse, I can't apply this field to conditionally format NEW visuals. 

I haven't changed the definition of the field:

3rd Grade STAR On Track_Trend Color =

SWITCH (
    TRUE()
    ,'DataView STAR_StateReadingEnglish_Current'[Change in % 3rd Grade On Level as number] >= 'Style Elements'[Threshold Up]
        ,  'Style Elements'[Positive Color]
    ,'DataView STAR_StateReadingEnglish_Current'[Change in % 3rd Grade On Level as number] > 'Style Elements'[Threshold Static Upper Rng]
        , 'Style Elements'[Trending Positive Color]          
    ,'DataView STAR_StateReadingEnglish_Current'[Change in % 3rd Grade On Level as number] >= 'Style Elements'[Threshold Static Lower Rng] && 'DataView STAR_StateReadingEnglish_Current'[Change in % 3rd Grade On Level as number] <= 'Style Elements'[Threshold Static Upper Rng]
        , 'Style Elements'[Neutral Color]  
    ,'DataView STAR_StateReadingEnglish_Current'[Change in % 3rd Grade On Level as number] > 'Style Elements'[Threshold  Down]
        , 'Style Elements'[Trending Negative Color]
    ,'DataView STAR_StateReadingEnglish_Current'[Change in % 3rd Grade On Level as number] <= 'Style Elements'[Threshold  Down]  
        , 'Style Elements'[Negative Color]
    ,"#000000"
)

I've verified that the field returns a valid Hex color: 

I've also verified that all of the other fields referenced in my 3rd Grade STAR On Track_Trend Color return valid data.
 
Does anyone have any idea what could be going on here?

4 Replies

  • I've narrowed it down. The problem is introduced when I reference 'Style Elements'[Positive Color] (or any of the other color fields). Here's the definition of [Positive Color]: 

    If I paste the hex value into the formatting field, it functions as expected. It's just the reference that makes it stop being able to be selected.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Kimber 

       

      I need to confirm with you, is the visual you are using a card or a new card?

       

      How was your visualization created? It looks like you are using two tables and some formulas. Are these formulas and the color definitions all measures? Or calculated columns? I cannot reproduce your scenario based on your description. Could you please share your PBIX? How to provide sample data in the Power BI Forum - Microsoft Fabric Community Please remove any sensitive data in advance.

       

      Best Regards,
      Yulia Xu

  • The problem occurs with any type of visual.  If I have a measure that performs a calculation on another measure, I can't use it for conditional formatting. It only works if the calculated measure doesn't refer to another measure. I think my file is corrupt. I have both Power BI Desktop and Power BI for Report Server installed on my computer. I created a file in Desktop, but must have accidentally opened and saved it in Report Server at one point. The next time I opened it in Desktop, I was warned that it was saved in an older format and some of my visualizations might not work, and that turned out to be true. Now I have this problem, even though I've saved it in Desktop, rebooted my machine, and reopened it in desktop. Is there any way to uncorrupt a file? Maybe some editing I could do in the xml? I'm also going to post this question separately, since it's technically a different topic.