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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
AndreiK15
Helper II
Helper II

Average won't return correct value

 Hi,

 

I'm trying to get average, but the return amount is wrong. I am using the followig formulas:

 

Sales Margin Format = CALCULATE(SUM(Sales[Sales Margin Amt]),ALLEXCEPT(Sites,Sites[Site Type 02]))
 
and I get 173.61M which is correct, but when I use the following formula:
 
Sales Margin Format (avg) = CALCULATE(AVERAGE(Sales[Sales Margin Amt]),ALLEXCEPT(Sites,Sites[Site Type 02]))
 
I get 1.15 and the average should be between 110k - 140k.
 
Thanks!
 
 
1 ACCEPTED SOLUTION
AndreiK15
Helper II
Helper II

Hi @amitchandak

 

I need average for site level 02. Site level 02 contain (STANDARD 1, STANDARD 2, CITY 1, CITY 2 etc.). I have found the solution though, but maybe you can tell if there is something else without combing all these. What I did is:

 

Count Format = CALCULATE(COUNTA(Sites[Site Type 02]),ALLEXCEPT(sites,Sites[Site Type 02]))

to get count on all stores for each site type 02

then

Sales Margin Format (avg) = DIVIDE([Sales Margin Format],[Count Format])
 
and I get the desired result. I can combine all these using var. Don't know though why when I use average as in my first post don't get the same value.
 
Thanks!

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@AndreiK15 , This is line level average. Are looking for site level Avg ?

 

Sales Margin Format (avg) = CALCULATE(AVERAGEX(values(Sites[Site]) , Calculate(Sum(Sales[Sales Margin Amt]))),ALLEXCEPT(Sites,Sites[Site Type 02]))

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
AndreiK15
Helper II
Helper II

Hi @amitchandak

 

I need average for site level 02. Site level 02 contain (STANDARD 1, STANDARD 2, CITY 1, CITY 2 etc.). I have found the solution though, but maybe you can tell if there is something else without combing all these. What I did is:

 

Count Format = CALCULATE(COUNTA(Sites[Site Type 02]),ALLEXCEPT(sites,Sites[Site Type 02]))

to get count on all stores for each site type 02

then

Sales Margin Format (avg) = DIVIDE([Sales Margin Format],[Count Format])
 
and I get the desired result. I can combine all these using var. Don't know though why when I use average as in my first post don't get the same value.
 
Thanks!

Helpful resources

Announcements
November Fabric Update Carousel

Fabric Monthly Update - November 2025

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

Users online (27)