Forum Discussion
DAX count blank rows based on conditions
- Anonymous2 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 __resultBest Regards,
Gao
Community Support TeamIf 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
Hi vivians - can you try the below measure to report only the available data upto Q3? and do a flag for measure for blank
N_complaints =
IF(
HASONEVALUE(tbl_report[Quarter]),
IF(
COUNTROWS(tbl_report) = 0,
BLANK(), -- If no rows, the quarter is "Non-return"
SUMX(
tbl_report,
IF(tbl_report[Return Status] = "Return", 1, 0)
)
),
BLANK()
)
add a flag measure also on the report
Regards,
Rajendra
Hi, what do you mean by adding a flag measure on the report?
I've tried the new measure that you've suggested, but it is still not showing 0 for Q1 where it is a nil return (which means 0 complaint).
Here is my test data: Report Test Data
Thanks again!