Forum Discussion

manojnikam3008's avatar
manojnikam3008
Frequent Visitor
5 years ago
Solved

Calculate Net Working Days

Hi Experts,   I am trying to calculate net working days between two dates that I'am capturing from slicer but somehow i am not getting the expected output.   Objective: I want to capture dates fr...
  • edhans's avatar
    5 years ago

    Hi manojnikam3008 - with a Date table this becomes really easy. 
    The measure is this:

     

    Working Days = 
    CALCULATE(
        COUNTROWS('Date'),
        'Date'[IsWorkingDay] = TRUE()
    )

     

    You can then create another measure to multiply that measure by 8 or whatever to get hours.

    See the file here for how this works.
    You'll notice I have filtered the date slicer by valid data in the fact table:

    Valid Data is just a measure that is COUNTROWS(Timesheets) - if there are records, the slicer will show it. Future and past dates though won't show up.

    If that isn't what you want, please provide more specifics per the info below. But the point is with a good date dimension table, the DAX becomes very easy.

    How to get good help fast. Help us help you.

    How To Ask A Technical Question If you Really Want An Answer

    How to Get Your Question Answered Quickly - Give us a good and concise explanation
    How to provide sample data in the Power BI Forum - Provide data in a table format per the link, or share an Excel/CSV file via OneDrive, Dropbox, etc.. Provide expected output using a screenshot of Excel or other image. Do not provide a screenshot of the source data. I cannot paste an image into Power BI tables.