Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

Date table DAX Help

Hi All,

 

I have a an attendance table which is tied to a date table. Issue I am having is there isnt data for every single day. I want the 0 days to count e.g.

 

Mon - 0%

Tue - 0%

Wed - 7%

Thu - 0%

Fri - 0%

 

The calculation I am trying to do would be 0+0+7+0+0 = 7 divided by 5 = 1 (rounded up)

 

How do I edit this to include 0 days? The highlighted is the only day in that week that had attendance

 

 

 

AVG % (M-F) = VAR
                WeekdayTable= FILTER(dDates, dDates[DayOfWeek] <> 6 && dDates[DayOfWeek] <> 0 && dDates[Year] = 2022)
            RETURN
            AVERAGEX(WeekdayTable, [DailyAttendance])

10 Replies

  • Mikelytics's avatar
    Mikelytics
    Resident Rockstar

    Hi  Anonymous 

     

    Please try putting "+0" behind your formula

     

    AVG % (M-F) = 
    VAR WeekdayTable = 
       FILTER(dDates, dDates[DayOfWeek] <> 6 && dDates[DayOfWeek] <> 0 && dDates[Year] = 2022)
    RETURN
    AVERAGEX(WeekdayTable, [DailyAttendance]) + 0
    

     

    Best regards

    Michael

    -----------------------------------------------------

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your thumbs up!

    @ me in replies or I'll lose your thread.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hey,

       

      That adds 0 at the Year level not the day level

       

      • Mikelytics's avatar
        Mikelytics
        Resident Rockstar

        ok, I have overseen something. Can you please try the following:

         

        AVG % (M-F) = 
        
        VAR WeekdayTable = 
           FILTER(dDates, dDates[DayOfWeek] <> 6 && dDates[DayOfWeek] <> 0 && dDates[Year] = 2022)
        RETURN
        AVERAGEX(WeekdayTable, [DailyAttendance] + 0) 

         

        Best regards

        Michael

        -----------------------------------------------------

        If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your thumbs up!

        @ me in replies or I'll lose your thread.