Forum Discussion
DAX - Count Row based on two criteria
Hi I am trying to count the rows of a table based on two criteria.
Criteria 1 - SLA Pass = "NO"
Criteria 2 - Date Logged >= 01/09/2020
The result I would exspect based on the sample table below would be equal to 4
I have tried this DAX measure
This measure works for the count rows and SLA Pass = No but seems to ignore date criteria?
| Repairs Table | |||
| Date Logged | Date Completed | Trade | SLA Passed |
| 01/08/2020 | 01/08/2020 | Plumbing | Yes |
| 12/08/2020 | 12/08/2020 | Plumbing | Yes |
| 11/08/2020 | 11/08/2020 | Plumbing | Yes |
| 17/08/2020 | 18/08/2020 | Plumbing | Yes |
| 01/09/2020 | 01/09/2020 | Plumbing | No |
| 01/09/2020 | 20/09/2020 | Plumbing | Yes |
| 07/08/2020 | 07/08/2020 | Electrical | No |
| 17/09/2020 | 17/10/2020 | Electrical | No |
| 03/09/2020 | 03/09/2020 | Electrical | No |
| 06/08/2020 | 06/09/2020 | Electrical | No |
| 25/08/2020 | 25/09/2020 | Electrical | No |
| 25/08/2020 | 25/09/2020 | Electrical | No |
| 15/08/2020 | 15/09/2020 | Electrical | No |
| 14/08/2020 | 14/09/2020 | Electrical | Yes |
| 14/09/2020 | 14/09/2020 | Electrical | Yes |
| 16/09/2020 | 16/09/2020 | Electrical | No |
| 18/08/2020 | 18/08/2020 | Roofing | Yes |
| 21/08/2020 | 21/08/2020 | Roofing | Yes |
| 13/08/2020 | 13/10/2020 | Roofing | No |
| 29/08/2020 | 29/08/2020 | Roofing | Yes |
| 21/08/2020 | 21/08/2020 | Roofing | No |
| 07/09/2020 | 07/10/2020 | Roofing | Yes |
thanks
Richard
cottrera , Try like
Measure = CALCULATE(
COUNTROWS(Repairs Table),
RepairsTable, Repairs Table[SLA Pass] ="NO",
Repairs Table[Date Logged]>= date(2020,09,01))
4 Replies
- nvprasad
Solution Sage
Hi,
I think you are passing date in "dd/mm/yyyy" format whereas powerbi is filtering in "mm/dd/yyyy".
Can you pass date using Date function and try.
Appreciate a Kudos! 🙂
If this helps and resolves the issue, please mark it as a Solution! 🙂Regards,
N V Durga Prasad- cottrera
Post Prodigy
Hi nvprasad thank you for responding but the suggestion did not work for me. I tried amitchandak suggesting which I posted as a solution.
thanks again RIchard
- amitchandak
Super User
cottrera , Try like
Measure = CALCULATE(
COUNTROWS(Repairs Table),
RepairsTable, Repairs Table[SLA Pass] ="NO",
Repairs Table[Date Logged]>= date(2020,09,01))- cottrera
Post Prodigy
Great that works!
thank you
Richard