Forum Discussion

roehler's avatar
roehler
Helper I
1 year ago
Solved

Help with NetworkDays column

Need help with a columnL   I've created a couple of columns, one to count the number of daily maintenance has been done for each machine.  It appears to be counting (and totaling) correctly:   ...
  • v-sdhruv's avatar
    1 year ago

    Hi roehler ,

    After analysing your query and looking at your file, I tried to re-produce the scenario and here are the steps that will help you with getting the right numbers on your matrix-

    1. You can create a Quarter column in the Daily Maintenance table as a calculated column-

    qtr_year = "Q" & FORMAT('Daily Maintenance'[Maintenance Date], "Q") & " " & FORMAT('Daily Maintenance'[Maintenance Date], "YYYY"). Therefore no need to add a seperate table.
    2. Holiday Table was not connected to any of the tables and hence your netwok days was not taking into account the holidays. Connect it with Maintenace Date as One-Many.
    3. To calculate Working days, what you can do instead of using Network Days, is create a flag for identifying days which fall into holiday s and Weekends as "H" and the rest as "W".
    Inorder to do that create a column 
    weekday = WEEKDAY('Daily Maintenance'[Maintenance Date],2) This will give Sat and Sun as 6,7 resp.
    4.Finally, create a flag that identifies your working days and Holidays/Weekends.
    Flag = if(OR(RELATED(Holidays[Date]) in { 'Daily Maintenance'[Maintenance Date]},'Daily Maintenance'[weekday]>5), "H","W")
    5. You can then, create a measure to count your working days.
    CountNetwork days = CALCULATE(COUNT('Daily Maintenance'[Flag]),'Daily Maintenance'[Flag]="W")

    You will get the following result-

     

    Attached file for reference.
    If the response has addressed your query, please Accept it as a solution ' so other members can easily find it.
    Thank You