Forum Discussion
FILIPKACZMAR
4 years agoAdvocate I
Counting days
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 tw...
- 4 years ago
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 ) )
tamerj1
4 years agoCommunity Champion
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
FILIPKACZMAR
4 years agoAdvocate I
THX for help, but I have got another error with code: to much argument, max for if is only 3
:(((
- tamerj14 years agoCommunity Champion
Please paste the complete code in a reply in order to check it.
- FILIPKACZMAR4 years agoAdvocate I=COUNTROWS (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 )))
- tamerj14 years agoCommunity Champion
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 ) )