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
PBIUWO
Helper III
Helper III

Help creating an average calculation

Hi All,

 

Currently, I am working on a project to show the daily inventory quantity at the item level and the movement of it compared to the average quantity. 

I receive a daily report of the inventory and the quantity, and in the Power BI, I have the excel report append.

I have created a filter to show the inventory quantity from todays date, but have problems when I look at the average. 

 

I am showing this as a bar graph, with a hierachy set up (Product line > Item code as the x axis and quantity as the y axis)  

Ex.

Hiearchy : 

Chocolate Bars = Product Line 

Kit Kat, Mars Bar = Item Code 

 

Report Example:

DateItem CodeQty
1/1/2020Kit Kat5
1/1/2020Mars Bar2
1/1/2020Coffee Crisp3
1/2/2020Kit Kat6
1/2/2020Mars Bar2
1/2/2020Coffee Crisp4
1/3/2020Kit Kat4
1/3/2020Mars Bar3
1/3/2020Coffee Crisp3

 

If today is 1/3/2020, then the quantity of Kit Kat is 4, Mars Bar 3, Coffee Crisp 3. The Product line quantity is 10. 

The average that I want is Product line = 11, . But in Power BI, it shows as 3.55 quantity. 

How can I get it to show Total Average Quantity is 11, then drill down to show averages across Item level (Kit Kat = 4.3, Mars Bar 2.7, Coffee Crip = 3.7) ? 

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

@PBIUWO 

 

You may try the measure below.

Measure =
AVERAGEX ( VALUES ( 'Table'[Date] ), CALCULATE ( SUM ( 'Table'[Qty] ) ) )

 

Community Support Team _ Sam Zha
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

2 REPLIES 2
v-chuncz-msft
Community Support
Community Support

@PBIUWO 

 

You may try the measure below.

Measure =
AVERAGEX ( VALUES ( 'Table'[Date] ), CALCULATE ( SUM ( 'Table'[Qty] ) ) )

 

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
Super User

Refer this

https://community.powerbi.com/t5/Desktop/Dynamic-measure-calculation-for-hierarchy-data/td-p/592546

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
https://community.powerbi.com/t5/Community-Blog/Winner-Topper-on-Map-How-to-Color-States-on-a-Map-wi...
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...
https://community.powerbi.com/t5/Community-Blog/Power-BI-Working-with-Non-Standard-Time-Periods/ba-p...
https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

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

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.