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
Nouha
Frequent Visitor

average of measure evaluated for eachrow

Hello, 

 

I have a data set that looks this way

 

Product     Sales      Original_Stock      %Sold

X                 8                    16                   50%

Y                  10                  150                  7%

Z                 2                      6                    33%

 

% sales is a calculated value 

 

I want to calculate a function that gives me the average of the % sold in a card visualization

 

if I use the fast calculations available in power bi it gives me 12% which is sum(sales)/sum(original_stock)

while i want the average of % sales evaluated for each row so average (50% ; 7%; 33%) which is 30%

 

 

i hope my problem is clear, 

 

thank you

 

Nouha 

1 ACCEPTED SOLUTION
AkhilAshok
Solution Sage
Solution Sage

Something like this maybe:

Total Sales = SUM(Table[Sales])
Total Stocks = SUM(Table[Original_Stock])
% Avg Stock = AVERAGEX ( VALUES ( Table[Product] ), DIVIDE ( [Total Sales], [Total Stocks] ) )

View solution in original post

5 REPLIES 5
AkhilAshok
Solution Sage
Solution Sage

Something like this maybe:

Total Sales = SUM(Table[Sales])
Total Stocks = SUM(Table[Original_Stock])
% Avg Stock = AVERAGEX ( VALUES ( Table[Product] ), DIVIDE ( [Total Sales], [Total Stocks] ) )

Thank you so much , this works perfectly

 

i have an extra question on the subject 

 

imagine we have a week column , and i want to calculate the average the same way but per week . how would i proceed ?

 

 

thank you 

You just have to create another measure with same logic as previous one replacing VALUES( Table[Product] ) with VALUES( Table[Week] )

sorry i wasn't clear, i mean an average function that takes into account both columns, product and week

You could use ALL(Table[Product], Table[Week]). But this will clear any filter context existing in Product or Week. If you want to preserve the filter context, you could use SUMMARIZE(Table, Table[Product], Table[Week])

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

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

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 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.