Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Sum values in column on Unique value

OrderIDOrderTotalItem
0001231000078
0001231000081
0001231000096
000789590078

 

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

 

  • Anonymous's avatar
    Anonymous
    4 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

  • Anonymous's avatar
    Anonymous
    Not 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.