cancel
Showing results for
Did you mean:

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

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.

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.

Thanks

1 ACCEPTED SOLUTION
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())

2 REPLIES 2
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())

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.

Thanks

Announcements

#### Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

#### Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

#### Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

#### The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors