Forum Discussion
Need to sum based on unique values
Hi,
Try with this Measure:
TotalOrderAmount = SUMX(DISTINCT(Table1[PO#]),CALCULATE(AVERAGE(Table1[Order Amount])))
Regars
Victor
Lima - Peru
- Mosa7 years agoNew Member
Hi.
Thanks for your help. I have a question with the same context. Now, when I unpivot comlumns, data is repeated. So, I want to sum the number of values in one column, but it appreas as doubled
- zeckert8 years agoHelper I
Thank you so much. It worked perfect.
- Anonymous7 years agoNot applicable
Hi Vvelarde,
The Measure "TotalOrderAmount = SUMX(DISTINCT(Table1[PO#]),CALCULATE(AVERAGE(Table1[Order Amount])))" works perfectly but I can not seem to wrap my head around how it works. Could you provide an explaintation?
Thanks - NaveenVerma7 years agoRegular Visitor
Hi Vvelarde,
Can we also use filter in the below formula?
TotalOrderAmount = SUMX(DISTINCT(Table1[PO#]),CALCULATE(AVERAGE(Table1[Order Amount])))
Regards,
Naveen Verma
- axelBose6 years agoFrequent Visitor
Thank you, Victor Vvelarde Need to sum based on unique values .
I have uesd this same measure in one of my reports. However, when I reference it in the following, I do not get the correct output.
Upper bound =VAR __AVG = sumX(distinct('Order History'[MaterialPlantKey]),calculate(average('Order History'[AvgNo0_Corrected Orders])))VAR __STDEV = sumX(distinct('Order History'[MaterialPlantKey]),calculate(average('Order History'[StdDevNo0_Corrected Orders])))VAR __UPPER_BOUND = __AVG + __STDEV *[Sigma level Value]return ( __UPPER_BOUND)In the above measure I am taking the distinct values by materialplant key for the average and standard deviation of orders in order to calculate the upper bound. The sigma level is simply the number of standard deviations that the user selects in the report with a slicer.
Thank you,
Axel - Anonymous5 years agoNot applicable
This worked but still dont understand why we need to use AVERAGE instead of SUM.