Forum Discussion
Mismatch in status count
Hi guys,
I have the following situation:
I am working with complaints, where we have a main complaint, and this is devided into multipe (or 1) 'subcomplaints'. Each complaint has its own status, e.g. completed, ongoing, delayed, etc.
When the status of all subcomplaints is' completed', the main complaint also should have the status 'completed'. Now, i want to count the complaints where this isn't the case; so i want to count the cases where all subcomplaints have the status 'completed', but the main complaint still has another status.
(The main- and subcomplaints are grouped by a unique id that they all share).
7 Replies
- NaveenGandhiMemorable Member
Hello QwertyMartijn
Try the below Dax.Main_Complaint = CALCULATE(COUNTROWS('complaint'),FILTER('complaint','complaint'[TypeKlacht] = "Main Complaint" &&'complaint'[Status] <> "Completed" &&CALCULATE(COUNTROWS('complaint'),ALLEXCEPT('complaint', 'complaint'[ID]),'complaint'[TypeKlacht] = "Sub Complaint",'complaint'[Status] <> "Completed") = 0))Dataset i used and result.Let me know if this helps.
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
- QwertyMartijnHelper II
Thanks for your quick reply. In the data you used, i dont think the correct count should be 1.
For both ID's 938831 and 867645 all subcomplaints are completed, but the status of the main complaint is still 'delegated. Therefore, i would like the code to return 2 counts.
- NaveenGandhiMemorable Member
QwertyMartijn
Please see for ID 938831 , One of the sub complaint is delegated, I changed it so to do a test case. With that sub complaint being changed to completed, The count is 2 as you expect.