Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Sum the value and find max

Hello All,   I have a table as below. Order Part QTY Year Date Buyer A001 12345 120 2019 20190102 ABC A001 12345 50 2019 20190212 ABC A002 12345 70 2019 20190315 DE...
  • Jihwan_Kim's avatar
    5 years ago

    Hi, Anonymous 

    Please check the below for creating a measure.

     

    Buyer Measure =
    IF (
    ISFILTERED ( 'Table'[Part] ),
    MAXX (
    FILTER (
    SUMMARIZE ( 'Table', 'Table'[Buyer], "@qtytotal", SUM ( 'Table'[QTY] ) ),
    [@qtytotal]
    = MAXX (
    GROUPBY (
    'Table',
    'Table'[Buyer],
    "@qty", SUMX ( CURRENTGROUP (), 'Table'[QTY] )
    ),
    [@qty]
    )
    ),
    'Table'[Buyer]
    )
    )

     

    Hi, My name is Jihwan Kim.

     

    If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

     

    Linkedin: linkedin.com/in/jihwankim1975/

    Twitter: twitter.com/Jihwan_JHKIM

  • CNENFRNL's avatar
    5 years ago
    Buyer Max = 
    MAXX( TOPN( 1, DISTINCT( Sales[Buyer] ), CALCULATE( SUM( Sales[QTY] ) ) ), Sales[Buyer] )

    bonus

    Buyer Min = 
    MAXX( TOPN( 1, DISTINCT( Sales[Buyer] ), CALCULATE( SUM( Sales[QTY] ) ), 1 ), Sales[Buyer] )