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
ooctaviano
Frequent Visitor

sum of measure (average)

Hello

 

I have a table like the one I'm pasting below

 

ooctaviano_0-1624932392351.png

I have to main columns I'm using qty (vtas pza) and cost

The issue i'm having is this

I created the following measures

1PROMVENTAS = AVERAGE(VENTAS[Vta Pzas])  - this is the average of units sold 
2COSTOTOTAL = AVERAGE(VENTAS[COSTOPROM]) - this is the price
VTACTOTOTAL = AVERAGEX(VENTAS, VENTAS[COSTOPROM]*[1PROMVENTAS])
ooctaviano_1-1624932603591.png it want it to sum 304.37 from the 5th column,
 
For some reason it does not adds the results of the ids in the table if I do this for the sums instead of average it works, what am I doing wrong.  The following is the case that  works but I need averages of units and costs and then sum of totals.
 
VTACTOTOTAL = AVERAGEX(VENTAS, VENTAS[COSTOPROM]*[1PROMVENTAS])
VTACTOTOTAL = sumX(VENTAS, VENTAS[COSTOPROM]*[1PROMVENTAS])
 
ooctaviano_2-1624932782905.png

 

 
Please advise
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@ooctaviano , if there are more than one rows for ID, this is what you can use

VTACTOTOTAL = AVERAGEX(VENTAS, VENTAS[COSTOPROM]*[1PROMVENTAS])

 

VTACTOTOTAL new = sumX(values(VENTAS[ID]),[VTACTOTOTAL])

 

or

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@ooctaviano , if there are more than one rows for ID, this is what you can use

VTACTOTOTAL = AVERAGEX(VENTAS, VENTAS[COSTOPROM]*[1PROMVENTAS])

 

VTACTOTOTAL new = sumX(values(VENTAS[ID]),[VTACTOTOTAL])

 

or

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

It worked great

Thanks a lot

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.

Top Solution Authors