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.
Good Morning,
I'm really struggling with this one in DAX as it'd be so simple with Excel.
Bascially, I have been sent a dataset with the due date of a project formatted in yyyy-mm:
How would I create a calculation to count the rows that match the current month? (2022-03) - a calculation that updates as the months pass and therefore the current month value changes.
Many thanks.
Solved! Go to Solution.
As a shortened form of the other answer, you can use :
Count of due dates this month =
COUNTROWS(FILTER(TableName, TableName[Target Date Month(If known)]= FORMAT(TODAY(),"YYYY-MM")))
As a shortened form of the other answer, you can use :
Count of due dates this month =
COUNTROWS(FILTER(TableName, TableName[Target Date Month(If known)]= FORMAT(TODAY(),"YYYY-MM")))
Hello
The answer depends on your data model set up, so at a top level you need a calculation like this one, but potentially with the VARs adjusted according to your model if you need something more sophisticated:
Countrows Current Month:=
VAR CurrentYear = FORMAT(YEAR(TODAY()), "0000")
VAR CurrentMonth = FORMAT(MONTH(TODAY()), "00")
VAR CurrentYear_Month = CurrentYear & "-" & CurrentMonth
RETURN COUNTROWS(FILTER(Data, Data[Target Date Month (If Known)]=CurrentYear_Month))
Hope that helps
Regards
Richard
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
43 | |
20 | |
18 | |
16 | |
15 |
User | Count |
---|---|
49 | |
26 | |
22 | |
17 | |
16 |