Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
cottrera
Post Prodigy
Post Prodigy

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 

Measure = CALCULATE(
COUNTROWS(Repairs Table),
RepairsTable, Repairs Table[SLA Pass] ="NO",
Repairs Table[Date Logged]>=01/09/2020)

 

This measure works for the count rows and SLA Pass = No but seems to ignore date criteria?       

Repairs Table 
Date LoggedDate CompletedTradeSLA Passed
01/08/202001/08/2020PlumbingYes
12/08/202012/08/2020PlumbingYes
11/08/202011/08/2020PlumbingYes
17/08/202018/08/2020PlumbingYes
01/09/202001/09/2020PlumbingNo
01/09/202020/09/2020PlumbingYes
07/08/202007/08/2020ElectricalNo
17/09/202017/10/2020ElectricalNo
03/09/202003/09/2020ElectricalNo
06/08/202006/09/2020ElectricalNo
25/08/202025/09/2020ElectricalNo
25/08/202025/09/2020ElectricalNo
15/08/202015/09/2020ElectricalNo
14/08/202014/09/2020ElectricalYes
14/09/202014/09/2020ElectricalYes
16/09/202016/09/2020ElectricalNo
18/08/202018/08/2020RoofingYes
21/08/202021/08/2020RoofingYes
13/08/202013/10/2020RoofingNo
29/08/202029/08/2020RoofingYes
21/08/202021/08/2020RoofingNo
07/09/202007/10/2020RoofingYes

 

thanks

Richard

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@cottrera , Try like

Measure = CALCULATE(
COUNTROWS(Repairs Table),
RepairsTable, Repairs Table[SLA Pass] ="NO",
Repairs Table[Date Logged]>= date(2020,09,01))

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@cottrera , Try like

Measure = CALCULATE(
COUNTROWS(Repairs Table),
RepairsTable, Repairs Table[SLA Pass] ="NO",
Repairs Table[Date Logged]>= date(2020,09,01))

Great that works!

 

thank you

 

Richard

nvprasad
Solution Sage
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

Hi nvprasad  thank you for responding but the suggestion did not work for me. I tried 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.