Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi everyone,
I have this code working to count the number of days there is between 2 dates.
VAR StartDate = MIN(_datemin_swapped, _datemax_swapped)
VAR EndDate = MAX(_datemin_swapped, _datemax_swapped)
VAR WeekendCount = COUNTROWS(FilteredDates)
Solved! Go to Solution.
Hi @pintoan
Two issues with your second expression:
The error message relates to point 1, since BLANK() is (possibly) passed as an argument of COUNTROWS.
Here is one way of fixing this (with some additional tweaks to the code):
VAR WeekendCount =
IF (
NOT ( StartDate = 0 || EndDate = 0 ), -- just test for 0 since BLANK() = 0
VAR FilteredDates =
FILTER (
CALENDAR ( StartDate, EndDate ),
WEEKDAY ( [Date] ) IN { 1, 7 } // 1 = Sunday, 7 = Saturday
)
RETURN
COUNTROWS ( FilteredDates )
)
Does this work for you?
Regards
Hi @pintoan
Two issues with your second expression:
The error message relates to point 1, since BLANK() is (possibly) passed as an argument of COUNTROWS.
Here is one way of fixing this (with some additional tweaks to the code):
VAR WeekendCount =
IF (
NOT ( StartDate = 0 || EndDate = 0 ), -- just test for 0 since BLANK() = 0
VAR FilteredDates =
FILTER (
CALENDAR ( StartDate, EndDate ),
WEEKDAY ( [Date] ) IN { 1, 7 } // 1 = Sunday, 7 = Saturday
)
RETURN
COUNTROWS ( FilteredDates )
)
Does this work for you?
Regards
thank you, perfect! marked as solution.
User | Count |
---|---|
94 | |
78 | |
73 | |
64 | |
60 |
User | Count |
---|---|
106 | |
97 | |
76 | |
63 | |
61 |