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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
nannimora
Helper I
Helper I

Weighted Average

Hello, 

I need to solve my problem. 

 

I have this table:

ArticoloDettaglio DocVendutoCostoMargineMargine %Quantità €/UM Costo/UMMarg Unit
20290FF - 547 - 30/01/2023€ 182,54€ 129,07€ 53,4729,29%30,73    5,94 €€ 4,20€ 1,74
20290FF - 486 - 30/01/2023€ 152,84€ 108,07€ 44,7729,29%25,73    5,94 €€ 4,20€ 1,74
20290FC - 453 - 27/01/2023-€ 293,32-€ 199,15-€ 94,1732,11%-51,46    5,70 €€ 3,87€ 1,83
TOTAL € 42,05€ 37,98€ 4,079,68 %5,00€ 8,41€ 7,60 

 

The Measures Are:

 

€/UM = 
IFERROR(
    [Venduto]/[Quantità],
    0
)

Costo / UM = 
IFERROR(
    [Costo]/[Quantità],
    0
)

 

 

The toal result of these measure is wrong. Because I'd like to have the weighted average of the specific values ( Es. € 5,94 , € 5,94, € 5,70).

 

Thanks

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @tomsmith213 ,

You can create another two new measure as below and put these new measures to replace the original measure

[€/UM] and [Costo / UM] separately onto the table visual. Later check if they can return the correct total values...
Measure = SUMX ( GROUPBY ( 'Table', 'Table'[Articolo], 'Table'[Dettaglio Doc] ), [€/UM] )
Measure 2 = SUMX ( GROUPBY ( 'Table', 'Table'[Articolo], 'Table'[Dettaglio Doc] ), [Costo / UM] )

yingyinr_1-1676256762423.png

 

In addition, you can refer the following links to try to solve your problem...

Why Your Total Is Incorrect In Power BI - The Key DAX Concept To Understand

Dax for Power BI: Fixing Incorrect Measure Totals

 

If the above one can't help you, could you please provide more raw data in your table 'Project Role Price' (exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following links to share the required info:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @tomsmith213 ,

You can create another two new measure as below and put these new measures to replace the original measure

[€/UM] and [Costo / UM] separately onto the table visual. Later check if they can return the correct total values...
Measure = SUMX ( GROUPBY ( 'Table', 'Table'[Articolo], 'Table'[Dettaglio Doc] ), [€/UM] )
Measure 2 = SUMX ( GROUPBY ( 'Table', 'Table'[Articolo], 'Table'[Dettaglio Doc] ), [Costo / UM] )

yingyinr_1-1676256762423.png

 

In addition, you can refer the following links to try to solve your problem...

Why Your Total Is Incorrect In Power BI - The Key DAX Concept To Understand

Dax for Power BI: Fixing Incorrect Measure Totals

 

If the above one can't help you, could you please provide more raw data in your table 'Project Role Price' (exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following links to share the required info:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.