cancel
Showing results for
Did you mean:

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a \$100 discount. Register Now

Frequent Visitor

## sum of measure (average)

Hello

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

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])
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])

1 ACCEPTED SOLUTION
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.

2 REPLIES 2
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.

Frequent Visitor

It worked great

Thanks a lot

Announcements

#### Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

#### Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

#### Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.