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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
bmk
Helper II
Helper II

Summation - TOP N Scenario

Hello,

 

I wish to perform a SUM operation based on a specific scenario. I'd tried TOPN but I belive this could be the wrong approach. Also, the 'Comments' column for each row of the serial number will always be unique.

 

Below is the sample table :

bmk_2-1646853806821.png

 

I want an output like this :

bmk_1-1646853581116.png

 

Would appreciate any guidance around this, thanks.

1 ACCEPTED SOLUTION
v-stephen-msft
Community Support
Community Support

Hi @bmk ,

 

Please try

Output =
CALCULATE (
    SUM ( 'Table'[Cat1] ),
    FILTER ( ALLSELECTED ( 'Table' ), [Comments] = MAX ( 'Table'[Comments] ) )
)
    + CALCULATE (
        SUM ( 'Table'[Cat2] ),
        FILTER ( ALLSELECTED ( 'Table' ), [Comments] = MAX ( 'Table'[Comments] ) )
    )

vstephenmsft_0-1648448100362.png

 

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-stephen-msft
Community Support
Community Support

Hi @bmk ,

 

Please try

Output =
CALCULATE (
    SUM ( 'Table'[Cat1] ),
    FILTER ( ALLSELECTED ( 'Table' ), [Comments] = MAX ( 'Table'[Comments] ) )
)
    + CALCULATE (
        SUM ( 'Table'[Cat2] ),
        FILTER ( ALLSELECTED ( 'Table' ), [Comments] = MAX ( 'Table'[Comments] ) )
    )

vstephenmsft_0-1648448100362.png

 

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Syk
Super User
Super User

From what you want your output to be, it seems like you just want a maximum for each serial number. Is this correct? You can create a measure = max(table[output]) and get what you're looking for I believe

This should work I believe. Would ALLEXCEPT be required at all?

That would depend on what context filters you are using and if you want them to affect the final value!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.