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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
cheid
Frequent Visitor

How to sum weekly total and 13-week avergage in total column using same measure.

I have matrix where I want to sum the weekly totals and put the 13 week average in the total column?  I am using the below to calculate the 13 week average and the other measure to combine the weekly sum with the 13 week average, but the numbers are much higher than they should be.  The final result I want is in the last screenshot.  Any help you can provide is appreciated.

 

Fixed combo = IF(
    ISINSCOPE('LookUp Calendar'[Date]),
    sum('Fixed'[Charge]),
    [Total Fixed - 13 Wks])

 

 

 

Total Fixed - 13 Wks =
VAR _Total =
CALCULATE(
    SUM('Fixed'[Charge]),
    DATESINPERIOD('LookUp Calendar'[Date],
    MAX('LookUp Calendar'[Date]), -91,DAY)
)

   
RETURN
_Total

 

cheid_0-1772822846040.png

cheid_1-1772822860002.png

 

1 ACCEPTED SOLUTION
grazitti_sapna
Super User
Super User

Hi @cheid,

 

This issue is due to how calues are calculated in Power BI, Totals do not aggregate the visible values; instead they recalculate the measure in a different filter context. Because of that, your 13-week window is being evaluated multiple times, which inflates the result.

 

The Measure which you've created returns sum of 13 weeks and not the average, and when used in totals it evaluates over the entire matrix context, which causes the large numbers.

 

You should use INSCOPE function to get the desired result.

 

I've attached a solution .pbix file with an example.

 

🌟 I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.
💡 Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.
🎖 As a proud SuperUser and Microsoft Partner, we’re here to empower your data journey and the Power BI Community at large.
🔗 Curious to explore more? [Discover here].
Let’s keep building smarter solutions together!

View solution in original post

2 REPLIES 2
grazitti_sapna
Super User
Super User

Hi @cheid,

 

This issue is due to how calues are calculated in Power BI, Totals do not aggregate the visible values; instead they recalculate the measure in a different filter context. Because of that, your 13-week window is being evaluated multiple times, which inflates the result.

 

The Measure which you've created returns sum of 13 weeks and not the average, and when used in totals it evaluates over the entire matrix context, which causes the large numbers.

 

You should use INSCOPE function to get the desired result.

 

I've attached a solution .pbix file with an example.

 

🌟 I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.
💡 Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.
🎖 As a proud SuperUser and Microsoft Partner, we’re here to empower your data journey and the Power BI Community at large.
🔗 Curious to explore more? [Discover here].
Let’s keep building smarter solutions together!

Ashish_Mathur
Super User
Super User

Hi,

Share the download link of the PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.