Forum Discussion

nabandla's avatar
nabandla
Helper I
2 years ago

Measure Use in Custom Formatting

HI @All,


I have created table Visual

with Sub-Category and Sales

and Created a DAX Measure  = IF(SUM(Sales)>=POWER(10,5),TRUE(),FALSE())

wanted to use this Measure in Conditional Formatting -->

 

When i am tryig apply based on Field Value
its not accepting the value
But when i change the calcualtion like below :

Morethan1Lakh = IF(SUM(Orders[Sales])>=POWER(10,5),1,0)

Than use them in Values in Conditional Formatting

working as expected why it was not working with Field Values what is the reason?



4 Replies

  • nabandla , In Power BI, conditional formatting based on field values requires the field to be a numeric value that can be evaluated directly. When you use a measure that returns a boolean value (TRUE/FALSE), it may not be directly usable in the conditional formatting settings because Power BI expects a numeric value for such operations.

     

    For more details you can go through below article

     

    Conditional Formatting in Power BI - Excelerator BI

    • nabandla's avatar
      nabandla
      Helper I

      bhanu_gautam- if i change the calcualtion from Boolean to 1 and 0 --> Selecting the Field Value still i am unable to populate that

      Do i have to change the calculation in a way to use it ??

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi nabandla ,

        Thank you bhanu_gautam   very much for the solution, and on the basis of what you've done, I'll suggest a little something that will further help him out:

        When I also set it to 1, 0 it is also not recognized here, because it is possible that 1, 0 is also treated as a boolean value for some specific values, so I tried to do a substitution for 1, 0.

        When we put double quotes around 1, 0, we can use field value, the

        This specifies that 1 and 0 are used as integers.

        It works, but it's pointless. If you want the same effect as rules, you can try defining the arrows manually.

        If you have other needs for conditional formatting, this is the documentation I found for you, I hope it helps.

        Apply conditional table formatting in Power BI - Power BI | Microsoft Learn

        Hope it helps!

        Best regards,
        Community Support Team_ Tom Shen

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