Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello everyone!!!
I am new at Power BI community (learning) and I have got a little problem.
At my new work I got the task to repair our PowerBI dashboard.
I have to count days between two dates, and I wrote this code:
Solved! Go to Solution.
Hi @FILIPKACZMAR
Please use the following
=
VAR First = 'SQA list'[End of Inspection].[Date]
VAR Last = 'SQA list'[Delivered Report].[Date]
VAR First1 =
IF ( First <= Last, First, Last - 1 )
VAR Last1 =
IF ( First <= Last, Last, First1 )
RETURN
COUNTROWS (
FILTER (
ADDCOLUMNS ( CALENDAR ( First1, Last1 ), "Day of Week", WEEKDAY ( [Date], 2 ) ),
[Day of Week] <> 6
&& [Day of Week] <> 7
)
)
Yes you can wrap CALENDAR with IF like
If ( 'SQA list'[End of Inspection].[Date] < 'SQA list'[Delivered Report].[Date],
CALENDAR ( 'SQA list'[End of Inspection].[Date], 'SQA list'[Delivered Report].[Date] ),
"Day of Week", WEEKDAY ( [Date], 2 )
))
the error will go but not sure about the results
THX for help, but I have got another error with code: to much argument, max for if is only 3
:(((
Hi @FILIPKACZMAR
Please use the following
=
VAR First = 'SQA list'[End of Inspection].[Date]
VAR Last = 'SQA list'[Delivered Report].[Date]
VAR First1 =
IF ( First <= Last, First, Last - 1 )
VAR Last1 =
IF ( First <= Last, Last, First1 )
RETURN
COUNTROWS (
FILTER (
ADDCOLUMNS ( CALENDAR ( First1, Last1 ), "Day of Week", WEEKDAY ( [Date], 2 ) ),
[Day of Week] <> 6
&& [Day of Week] <> 7
)
)
thx for help, but it is still not working... have you got maybe 5 min to call you teams? I will send you gift from poland 🙂
last [Date] is not collored
Hi:
You can use DATESBETWEEN function:
For example:
Dates = ADDCOLUMNS ( CALENDAR (FIRSTDATE(Sheet1[ Date]), TODAY()), "year", YEAR ( [Date] ), "MonthNumber", FORMAT ( [Date], "MM" ), "year-month", FORMAT ( [Date], "YYYY-MM" ), "month-year", FORMAT ( [Date], "MM-'YY" ) )
User | Count |
---|---|
22 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
25 | |
12 | |
11 | |
7 | |
6 |