Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi Team,
Please help me with SUMPRODUCT similar with excel in DAX measure... Below are my Actuals in Main Category and Lines. How to get weighted average using SUMPRODUCT logic in DAX command?
I want to get below highlight output using DAX command...
Solved! Go to Solution.
Hi @Sandeep_PowerBI ,
In Power BI, you need to use unpivot and pivot for your data first, and then you can perform calculations.
After transformation, the data is as follows.
Create this measure:
Measure =
VAR _table =
SUMMARIZE (
'Table',
[Line],
[ABC],
[HMP],
"Product", SUM ( 'Table'[ABC] ) * SUM ( 'Table'[HMP] )
)
RETURN
DIVIDE (
SUMX ( _table, [Product] ),
SUMX ( FILTER ( ALL ( 'Table' ), [Line] = MAX ( 'Table'[Line] ) ), [HMP] )
)
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Sandeep_PowerBI ,
In Power BI, you need to use unpivot and pivot for your data first, and then you can perform calculations.
After transformation, the data is as follows.
Create this measure:
Measure =
VAR _table =
SUMMARIZE (
'Table',
[Line],
[ABC],
[HMP],
"Product", SUM ( 'Table'[ABC] ) * SUM ( 'Table'[HMP] )
)
RETURN
DIVIDE (
SUMX ( _table, [Product] ),
SUMX ( FILTER ( ALL ( 'Table' ), [Line] = MAX ( 'Table'[Line] ) ), [HMP] )
)
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you @Anonymous its working...
By,
Sandeep
Hi @Sandeep_PowerBI as I wrote, I organize your excel data into different structure /unpivoting and basically rename your Actual to Weight to follow calculation logic.
In red below you can find example your and mine data.
Proud to be a Super User!
Hi @Sandeep_PowerBI I organized your table as shown on first picture below, new calculate column
and created 3 Measures below. On last picture there are results. I hope this help.
My Excel from your data
Proud to be a Super User!
Hi @some_bih
Thanks for providing solution but in my data, I dont have weight value columns f... Only 2 categories HMP and ABC values...
How did you calc weight (column F)
Hi @Sandeep_PowerBI the best would be to organize columns like amounts should be in one columns and weigths in another column (date is some third columns, if needed).
Check example for similar request https://community.fabric.microsoft.com/t5/Desktop/Weighted-Average-DAX/td-p/1661527
Proud to be a Super User!
Hi,
Thanks for response,
Actually separating in 3 columns is fine. Done in Transaformation unpivot. but, the same calculation is not matching to my requiremet. I want to calculate weighted Average value using DAX...
=SUMPRODUCT(D2:O2,D5:O5)/SUM(D2:O2) - using Excel
=SUMPRODUCT(HMP(D2:O2), ABC(D5:O5))/SUM(HMP(D2:O2))
Thanks,
Sandeep
Hi @Sandeep_PowerBI if possible provide data not as picture so I can use it for testing measure to get your expected output
Proud to be a Super User!
How to attach excel sheet?
Hi @Sandeep_PowerBI check part example from link, ot cpuld be in web page values
Proud to be a Super User!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
8 | |
8 | |
8 |
User | Count |
---|---|
13 | |
12 | |
11 | |
10 | |
8 |