Forum Discussion

ashmitp869's avatar
ashmitp869
Responsive Resident
2 years ago
Solved

Help needed in dax expression - for Conditional Formating for background color.

Hi All,

 

Help needed for  Conditional Formating for background color.

 

My requirement :

 

=if(Len([PTD - Revenue Accrual (Ex-GST)])>0 and [PTD - Revenue Accrual (Ex-GST)]<>'-', if([PTD - Revenue Accrual (Ex-GST)]>([MTD Total - Revenue (Ex-GST)]*.3),RGB(255,199,206)) )

 

 

My expression:

 

 

PTD - Revenue Accrual Color = SWITCH( TRUE(), AND( LEN([PTD - Revenue Accrual(Ex-GST)]) > 0, [PTD - Revenue Accrual(Ex-GST)] <> "-" ), IF( [PTD - Revenue Accrual(Ex-GST)] > ([MTD Total - Revenue(Ex-GST)] * 0.3), "#FFC7CE" // This is a hex color code for a shade of red ), BLANK() )

 

 

Help me with the expression . When using RETURN key word its giving me error.

 

 

  • Thanks for the help..

    PTD - Revenue Accrual Color =  
    SWITCH(
            TRUE(),
            AND(
                LEN([PTD - Revenue Accrual(Ex-GST)]) > 0, 
                [PTD - Revenue Accrual(Ex-GST)] <> BLANK()
            ),      IF(
                [PTD - Revenue Accrual(Ex-GST)] > ([MTD Total - Revenue(Ex-GST)] * 0.3), 
               "#FFC7CE"  // This is a hex color code for a shade of red
            ),
            BLANK()
        )

    instead of "-" I used Blank() 

7 Replies

  • hello ashmitp869 

     

    you use RETURN when you are using VAR.

    if there is no VAR in prior to, then no need to put RETURN.

    Thank you.

    • ashmitp869's avatar
      ashmitp869
      Responsive Resident

      Thanks for the explanation Irwan .

       

      But do you know why my expression is not working ?

      • Irwan's avatar
        Irwan
        Super User

        hello ashmitp869 

         

        i suspect because of that RETURN, no?

        Have you tried deleting that RETURN command? let see if your DAX still not working even after deleting RETURN.


        thank you.