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.
hi, i would like to know how to calculate count of an specific day of week.
Ex: (2018-01-01 to 2018-12-31 , "Monday")
result: 52.
Solved! Go to Solution.
Try this
CountMonday = VAR StartDate = DATE ( 2018, 1, 1 ) VAR EndDate = DATE ( 2018, 12, 31 ) VAR Temp = ADDCOLUMNS ( GENERATESERIES ( StartDate, EndDate ), "WeekDay", WEEKDAY ( [Value], 2 ) ) RETURN COUNTROWS ( FILTER ( Temp, [WeekDay] = 1 ) )
Try looking into the WEEKDAY function - say you've got a calendar table that runs through 2018, the DAX function calculate(countrows[DateTable],weekday([datefield])=2) should return what you're looking for
i need the count between two dates.
Try this
CountMonday = VAR StartDate = DATE ( 2018, 1, 1 ) VAR EndDate = DATE ( 2018, 12, 31 ) VAR Temp = ADDCOLUMNS ( GENERATESERIES ( StartDate, EndDate ), "WeekDay", WEEKDAY ( [Value], 2 ) ) RETURN COUNTROWS ( FILTER ( Temp, [WeekDay] = 1 ) )
Hi,
Would it be possible to amend the solution below to return 0 if there are no Mondays within the date range provided?
Currently it generates an error 'Calculation error in measure, The arguments in GenerateSeries function cannot be blank'
I am trying to use it to record which days were covered by an absence period, but as these periods can be less than a week, there isnt necessarily a Monday in the date range I am providing.
I tried changing the final line to :-
However this clearly isnt correct as it doesnt work,
Any assistance would be really appreciated.
Thanks
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 |
---|---|
112 | |
97 | |
84 | |
67 | |
61 |
User | Count |
---|---|
150 | |
120 | |
99 | |
87 | |
68 |