Forum Discussion
Sum values in column on Unique value
| OrderID | OrderTotal | Item |
| 000123 | 100 | 0078 |
| 000123 | 100 | 0081 |
| 000123 | 100 | 0096 |
| 000789 | 59 | 0078 |
The Total returned for order 000123 was 300 when it really should be 100. So the totals for all orders returned as 359 when really it was 159.
I tried the following DAX code but it returned all 0's. I want to be abel to return the sum of OrderTotals for only unique OrderID's.
Total = SUMX(DISTINCT(Data[OrderID]), FIRSTNONBLANK(Data[OrderTotal], 0))
- Anonymous4 years ago
Hi Anonymous
I restore your data and create a sample , the sum of [OrderID] is 159 . I have attached my pbix file , you can refer to it and check the original data in your sample .
Best Regard
Community Support Team _ Ailsa Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 Replies
- freginierSolution Sage
what's the excepted result ?
- AnonymousNot applicable
Hi Anonymous
I restore your data and create a sample , the sum of [OrderID] is 159 . I have attached my pbix file , you can refer to it and check the original data in your sample .
Best Regard
Community Support Team _ Ailsa Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.