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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
pintobean87
Frequent Visitor

Error while trying to sum and get the average from two calculated columns

Hi all.

 

So I have the following 3 columns in my table: Name, QTR 1, QTR 2. QTR 1 and 2 are calculated columns that I made to get the difference from other columns.

pintobean87_0-1682620310002.png

It's important to note that there might be multiple row entries for the same name as shown above.

 

So what I'm trying to do is to get the total average in QTR 1 for each name. For example, for Red under QTR 1, the sum would be 17 and so the result should display the average which is 5.66.  This would repeat in QTR 2, so the average for Red would be 3 there.

 

Finally, the end result should add the two averages together from both columns, so in the case of Red, it would add 5.66 and 3 to return 8.66

 

I wrote the DAX below but keep running into an error that says something about "function groupby scalar expressions have to be aggregation." 

 

Not sure how to figure this out. Any help is appreciated!

 

 

Total Average by Name = AVERAGEX(GROUPBY('Table', 'Table'[Name], "TotalValue", (AVERAGE('Table'[QTR1]) + AVERAGE('Table'[QTR2]))), [TotalValue])

2 REPLIES 2
Anonymous
Not applicable

Hi @pintobean87 

Try the following measure

Measure = var a=CALCULATE(AVERAGE('Table'[QTR1]),ALLEXCEPT('Table','Table'[Name]))
var b=CALCULATE(AVERAGE('Table'[QTR2]),ALLEXCEPT('Table','Table'[Name]))
return a+b

Output

vxinruzhumsft_0-1682921664450.png

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

pintobean87
Frequent Visitor

Or is there just an easier way to do the math than what I'm trying to do?

Helpful resources

Announcements
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.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

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