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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Average total sale given line item data

Dataset example:

SALE_IDPRICE_SOLD
100110
100120
100230
100340

There are 3 sales, 1001, 1002, and 1003.

1001 has two line items. I need to calculate average sale total. For instance, ((10 + 20) + 30 + 40) / 3

How do I calculate that in DAX?

 

Thank you.

1 ACCEPTED SOLUTION
lkalawski
Memorable Member
Memorable Member

Hi @Anonymous 

You can create a measure like this:

Measure = 
VAR _cntOfUsers = DISTINCTCOUNT('Table (2)'[SALE_ID])
VAR _sumOfSales = Sum('Table (2)'[PRICE_SOLD])

RETURN DIVIDE(_sumOfSales,_cntOfUsers,0)



_______________
If I helped, please accept the solution and give kudos! 😀

View solution in original post

1 REPLY 1
lkalawski
Memorable Member
Memorable Member

Hi @Anonymous 

You can create a measure like this:

Measure = 
VAR _cntOfUsers = DISTINCTCOUNT('Table (2)'[SALE_ID])
VAR _sumOfSales = Sum('Table (2)'[PRICE_SOLD])

RETURN DIVIDE(_sumOfSales,_cntOfUsers,0)



_______________
If I helped, please accept the solution and give kudos! 😀

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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