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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Anonymous
Not applicable

DAX code help to calculate 3 different Average

Dear Experts

 

I would like to view 3 different average calculation on my report.

 

avg1.JPG

 

Business Share = Qty (ex Mat9)/Counter Size

Avg1 : Sum (Qty (exmat9))/Sum(Counter Size).

 

Avg2 : Sum of Business Share / No of Weeks only for Customer Group Alpha.

 

Avg3 : Sum (Qty (exmat9) for all customers of Group Alpha /Sum(Counter Size) for all customers of Group Alpha weekwise. (Ref: Page 2 on the PBI sample report)

 

Please can someone help me the DAX code to achieve these columns.
Attached the PBI sample report along.

 

https://drive.google.com/file/d/1GAZhMuXREG0ZxzcSDbMrPUdtT79VGqDG/view?usp=sharing

 

Thanks
Mahad

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try measures like

 

calculate(divide(Sum (Table[Qty (exmat9)]),Sum(Table[Counter Size])), allselected())

calculate(divide(Sum (Table[Business Share]),Calculate(Countrows(Table), filter(Table, Table[Customer Group] ="Alpha"))), allselected())

 

calculate(divide(Calculate(Sum (Table[Business Share]), filter(Table, Table[Customer Group] ="Alpha")),Sum(Table[Counter Size])), allselected())

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Try measures like

 

calculate(divide(Sum (Table[Qty (exmat9)]),Sum(Table[Counter Size])), allselected())

calculate(divide(Sum (Table[Business Share]),Calculate(Countrows(Table), filter(Table, Table[Customer Group] ="Alpha"))), allselected())

 

calculate(divide(Calculate(Sum (Table[Business Share]), filter(Table, Table[Customer Group] ="Alpha")),Sum(Table[Counter Size])), allselected())

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Dear Amit

 

Thanks for your code. I could not achieve the result except for 1st column. I have attached the sample data please can you try the code and advise me.

 

Appreciate your help on this.

 

Thanks

Mahad

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.