Forum Discussion
How to Sum Distinct Based on another Column Value
Order Operation Yield Area
ID1 1 1 area1
ID1 2 1 area2
ID1 3 1 area3
ID2 1 1 area1
ID2 2 1 area2
ID2 3 1 area3
I want the measure to sum yield. So when I have area 1 filtered, it'll be 2.
But If I select area 1 and 2, it'll only sum the highest operation of each unique order. So it would still output 2. I don't just want a distinct table, I was a distinct table that only keeps the highest operation number.
Is this possible?
User5231 try this measure:
Yield Sum = CALCULATE ( SUM ( TableTest[Yield] ), FILTER ( ALLEXCEPT ( TableTest, TableTest[Area], TableTest[Order] ), TableTest[Operation] = MAX ( TableTest[Operation] ) ) )I would π Kudos π if my solution helped. π If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
4 Replies
- parry2kSuper User
User5231 try this measure:
Yield Sum = CALCULATE ( SUM ( TableTest[Yield] ), FILTER ( ALLEXCEPT ( TableTest, TableTest[Area], TableTest[Order] ), TableTest[Operation] = MAX ( TableTest[Operation] ) ) )I would π Kudos π if my solution helped. π If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
- User5231Helper II
I will try this and let you know. Also, would it be possible to make a calculated column that did the same thing? Like gave you an indicator for the last operation for each order out of each area? That would be more ideal because I could turn on the Y or N indicator with a filter.
- User5231Helper II
Anyone know a way to do the column indicator request? Would really be helpful.
Thanks again.
- v-xuding-msftCommunity Support
Hi User5231 ,
I have tested the formula that parry2k created. It works perfectly. If it works for you, please accept the helpful answer as a solution. If not, please share the expected results. Then we will understand clearly.