Forum Discussion

jason435's avatar
jason435
Icon for Helper II rankHelper II
9 years ago
Solved

Daily rolling average for total transactions

Hi,   I feel like I am very close, but can't figure out what I am doing wrong.    I have a table with all transactions, date, revenue per transaction. This is have I have for a new column:\   C...
  • v-qiuyu-msft's avatar
    9 years ago

    Hi jason435,

     

    From your description, per day has multiple transactions, you want to do moving 7 days average for everyday total transactions, right?

     

    Assume the sample data like below:

     

     

    You can create a summarized table to aggregate total transactions per day, then create a calculated column to do moving 7 days average. For details, you can download attached pbix file.

     

    Table = SUMMARIZE('Patient Visits','Patient Visits'[Date],"TotalRevenue",SUM('Patient Visits'[Patient_Revenue]))

     

    Calc_7daysrolling = CALCULATE( AVERAGEX(ALLSELECTED('Table'),'Table'[TotalRevenue]), DATESINPERIOD('Table'[Date], LASTDATE('Table'[Date]),-7,DAY))

     

     

     

    Best Regards,
    Qiuyun Yu