Forum Discussion

BODMON's avatar
BODMON
New Member
3 years ago
Solved

Daily Average as a Column in Matrix

Hello community!   I'm looking to create a table and add a daily average weekly column for the currently selected week, and a daily average weekly column for the previous week as a comparison.   ...
  • FreemanZ's avatar
    3 years ago

    hi BODMON 

    not sure if i fully get you, adding additional column to a matrix might not be easy, you may try to add new table or matrix visual, like this:

     

    the code for the two measures:

    Daily Avg CW = 
    VAR _workingdays =
    COUNTROWS(
        FILTER(
            Dates,
            Dates[Business_Day]=1
        )
    )
    RETURN
    DIVIDE(
        SUM(TableName[Tickets]),
        _workingdays
    )
    
    Daily Avg LW = 
    CALCULATE(
        [Daily Avg CW],
        DATEADD(Dates[Date], -7, DAY)
    )

     

    in the second table visual, there are actually three fields: user column and the two measures. 

     

  • BODMON's avatar
    BODMON
    3 years ago

    Crazy. Figured it out.

     

    The original source data for the ticket table has a date with a time stamp on it.

     

    So even though its format was date and I convert it to short date in PowerBI, it still has an impact. It was not liking the relationship between the ticket table and the date table.

     

    I had to go to the source in SQL and convert it there so it would come through just as a date.

     

    Very annoying when something so small takes so long to troubleshoot.

     

    Thank you for your help FreemanZ , the weekly averages work!!

     

     

    Now I need to see how I can put those weekly average columns into one matrix table, rather than 2 matrix tables…reading Greg_Deckler 

    post and it seems like it’s going to be fun 🙂