cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
EloiseJane
Frequent Visitor

Direct Query working day count date dax

Hi

 

HELP...

 

I am trying to do a date between count with some direct query data to estabish the amount of working days between application received and application validated.

 

I have tried calulate(sum of working days(date between function) on an import that works, but my data set is to big for an import so i need to find a way around the limiation for direct query. Any ideas please?! i have an calander ref point already in my model.

 

thanks

Eloise

1 ACCEPTED SOLUTION
Eyelyn9
Community Support
Community Support

Hi @EloiseJane ,

 

Since this: i have an calander ref point already in my model. Please try:

Measure =
VAR _t =
    FILTER (
        ADDCOLUMNS ( 'Calendar', "WeekDay", WEEKDAY ( [Date], 2 ) ),
        [Date] >= MAX ( 'DateTable'[application received] )
            && [Date] <= MAX ( 'DateTable'[application validated] )
            && [WeekDay] IN { 1, 2, 3, 4, 5 }
    )
RETURN
    COUNTROWS ( _t )

Eyelyn9_0-1634869381876.png

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Eyelyn9
Community Support
Community Support

Hi @EloiseJane ,

 

Since this: i have an calander ref point already in my model. Please try:

Measure =
VAR _t =
    FILTER (
        ADDCOLUMNS ( 'Calendar', "WeekDay", WEEKDAY ( [Date], 2 ) ),
        [Date] >= MAX ( 'DateTable'[application received] )
            && [Date] <= MAX ( 'DateTable'[application validated] )
            && [WeekDay] IN { 1, 2, 3, 4, 5 }
    )
RETURN
    COUNTROWS ( _t )

Eyelyn9_0-1634869381876.png

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

amitchandak
Super User
Super User

@EloiseJane , You can try a measure like

Work Day = COUNTROWS(FILTER(ADDCOLUMNS(CALENDAR(Min(Table[Start Date]),Max(Table[End Date])),"WorkDay", if(WEEKDAY([Date],2) <6,1,0)),[WorkDay] =1))

 

or

 

Work Day = sumx(values(Table[ID]), COUNTROWS(FILTER(ADDCOLUMNS(CALENDAR(Min(Table[Start Date]),Max(Table[End Date])),"WorkDay", if(WEEKDAY([Date],2) <6,1,0)),[WorkDay] =1)) )

 

 

refer

Business Days/ Workdays, with or without date table: https://youtu.be/Qv4wT8_P-AA

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin
Want To Learn Power BI
Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
Proud to be a Super User!

Helpful resources

Announcements
Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Top Solution Authors
Top Kudoed Authors