Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
jason435
Helper II
Helper II

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:\

 

Calc_7daysrolling = CALCULATE( AVERAGEX('Patient Visits','Patient Visits'[R_Total_Revenue]), DATESINPERIOD('Patient Visits'[Date], LASTDATE('Patient Visits'[Date]),-7,DAY))

 

 

I have a feeling it has to do with the face I have muliple transactions per day. Any ideas?

 

Thanks in advance. 

1 ACCEPTED SOLUTION
v-qiuyu-msft
Community Support
Community Support

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:

 

q6.PNG

 

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))

 

q7.PNG

 

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-qiuyu-msft
Community Support
Community Support

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:

 

q6.PNG

 

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))

 

q7.PNG

 

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Interkoubess
Solution Sage
Solution Sage

Hi @jason435,

 

Can you show us a sample date with you desired result.

We will try to figure out.

Thx

Its is pretty simple transactional data.

 

Patient_Revenue

Date

Patient ID

Patient_Revenue

 

The rest isn't needed for this.

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors