Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
User5231
Helper II
Helper II

How to Sum Distinct Based on another Column Value

So I am trying to make a measure that sums a column, but sums it distinctly based on criteria.

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?
 
1 ACCEPTED SOLUTION
parry2k
Super User
Super 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!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

4 REPLIES 4
v-xuding-msft
Community Support
Community 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.

 

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
parry2k
Super User
Super 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!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

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.

 

Anyone know a way to do the column indicator request? Would really be helpful.

 

Thanks again.

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.