Forum Discussion

vivians's avatar
vivians
Frequent Visitor
2 years ago
Solved

DAX count blank rows based on conditions

Hi there, I am trying to create a table and chart based on this data: Year Quarter Team Return Status Complaints Working Days 2023/4 Q1 ABC Nil return   2023/4 ...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi vivians ,

    Please try this measure:

    N_complaint = 
    VAR __count1 = CALCULATE(COUNTROWS('tbl_Report'),'tbl_Report'[Return Status]="Non-return", ALLEXCEPT('tbl_Report',dim_Quarter[Quarter]))
    VAR __count2 = CALCULATE(COUNT(tbl_Report[Return Status]),'tbl_Report'[Return Status] IN {"Return", "Nil return"},ALLEXCEPT('tbl_Report',dim_Quarter[Quarter]))
    VAR __result = IF(ISBLANK(__count1) && NOT ISBLANK(__count2),CALCULATE(COUNT(tbl_Report[Return Status]),'tbl_Report'[Return Status]="Return") + 0)
    RETURN
    __result

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group