PowerBI : How to Calculate number of WorkingDays between 2 given dates
Here i am going to explain how to calculate number of working dates between to given dates.
In my approach i am taking a table called Holidays which contains holidays as shown below
Once you have this table , we need to use this table in our Datetime table to calculate IsworkingDay column.
Now give the relationship between Datetime and Holidays tables as shown below
Now give the relationship between Datetime and Holidays tables as shown below
DAX : IsWorkingDay = IF (NOT(DateTime[Day of Week]= "Saturday" || (DateTime[Day of Week]= "Sunday")) && COUNTX(RELATEDTABLE(Holidays),2)<1,1,0)
Now you can create calculated column or measure
Total Working Days Column =
SUMX (
FILTER (
'Datetime',
'Datetime'[Date] >= Tasks[Input Start Date]
&& 'Datetime'[Date] <= Tasks[Input End Date]
),
'Datetime'[IsWorkingDay]
)
Total Working Days Measure =
SUMX (
FILTER (
'Datetime',
'Datetime'[Date] >= MIN ( Tasks[INput Start Date] )
&& 'Datetime'[Date] <= MAX ( Tasks[Input End Date] )
),
'Datetime'[IsWorkingDay]
)
Thank you so much for making understand the use of Power BI through mathematical and logical problems and finding out solutions.
ReplyDeletePowerbi Read Soap