Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

If Condition Need help

Hi,

I've below DAX logic for my chart.  I've tried but no luck. Can someone help me on this one?

 

IF 

CALCULATE(count(CM[Change ID]),CM[Overdue / Not overdue]="Not Overdue")        is <1  
then 
CALCULATE(count(CM[Change ID]),CM[Overdue / Not overdue]="Not Overdue",CM[CMLastMonthYear]=1)
Else give "No Data Message"
  • Hi Anonymous ,

     

    Please create a measure like this.

    Measure = 
    IF ( 
        CALCULATE(
            COUNT(CM[Change ID]), 
            FILTER(
                ALLSELECTED('CM'),
                CM[Overdue / Not overdue] = "Not Overdue"
            ) 
        ) < 1 , 
        CALCULATE(
            COUNT(CM[Change ID]), 
            FILTER(
                ALLSELECTED('CM'),
                CM[Overdue / Not overdue] = "Not Overdue" && CM[CMLastMonthYear] = 1
            )
        ) ,
        "No Data Message"
    )

     

    Best regards,
    Lionel Chen

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

5 Replies

  • Hi Anonymous 

    If you provided your data and/or PBIX it woudl be easier to work on this.

    Try this

    IF ( 
        
        CALCULATE(count(CM[Change ID]), CM[Overdue / Not overdue] = "Not Overdue") < 1 , 
        
        CALCULATE(count(CM[Change ID]), CM[Overdue / Not overdue] = "Not Overdue" && CM[CMLastMonthYear] = 1) ,
        
        "No Data Message"
    
        )

    Regards

    Phil

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Philip,

      Thanks for your reply. I get below error msg.

       

      For uploading pbix file/Data. I do not see any option to upload. Thanks!

  • Hi Anonymous 

    Try this

    IF ( 
        
        CALCULATE(count(CM[Change ID]), SELECTEDVALUE(CM[Overdue / Not overdue]) = "Not Overdue") < 1 , 
        
        CALCULATE(count(CM[Change ID]), SELECTEDVALUE(CM[Overdue / Not overdue]) = "Not Overdue" && SELECTEDVALUE(CM[CMLastMonthYear]) = 1) ,
        
        "No Data Message"
    
        )

    Without your data I can't be sure this si what you need.

    Regards

    Phil

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi,

      SelectedValue function in Dax True/False not accepting. 

      Any other methods to do this? altease with out "No Data message" is possible? 

      Many thanks for your try 😊

       

       

      • v-lionel-msft's avatar
        v-lionel-msft
        Community Support

        Hi Anonymous ,

         

        Please create a measure like this.

        Measure = 
        IF ( 
            CALCULATE(
                COUNT(CM[Change ID]), 
                FILTER(
                    ALLSELECTED('CM'),
                    CM[Overdue / Not overdue] = "Not Overdue"
                ) 
            ) < 1 , 
            CALCULATE(
                COUNT(CM[Change ID]), 
                FILTER(
                    ALLSELECTED('CM'),
                    CM[Overdue / Not overdue] = "Not Overdue" && CM[CMLastMonthYear] = 1
                )
            ) ,
            "No Data Message"
        )

         

        Best regards,
        Lionel Chen

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