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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
CHMay4253
Frequent Visitor

Creating static weekly AVG price and qty purchased values

Hi,

 

I am trying to create a cost report that will display weekly costs by associated product measured against data set avg.

 

The bit I am stuck on is getting the Weekly AVG price and qty purchased to stay as is in the measure when I add the month into the filter conext.

 

I'm new(ish) to DAX and the only measures that I was able to create were -

 

QTY_Purchased=CALCULATE(SUM(FUEL_REPORT[Quantity]),

FILTER(FUEL,FUEL[Key]=7||FUEL[Key]=8||FUEL[Key]=16||FUEL[Key]=20),

FILTER(Site_FUELS,Site_FUELS[SITE]="SHELL"))

 

and 

 

AVG Prrice=AVERAGEX(VALUES(Date_lookup[WeekNum]),[AVG Diesel])

 

These two don't work as as soon as I change week to month, it averages the month (as it should) and I don't know how to make those values static to multiply them by each other to get the sum monthly cost.

2 REPLIES 2
amitchandak
Super User
Super User

@CHMay4253 , Try like

AVG Prrice=calculate(AVERAGEX(VALUES(Date_lookup[WeekNum]),[AVG Diesel]), removefilters(Date_lookup[WeekNum]))

 

or

 

AVG Prrice=calculate(AVERAGEX(VALUES(Date_lookup[WeekNum]),[AVG Diesel]), allselected(Date_lookup[WeekNum]))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi,

 

That still gives me a monthly or yearly average depending on the filter context.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

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

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.