Forum Discussion

Jos13's avatar
Jos13
Helper III
5 years ago
Solved

Sum Distinct Values

Hi Team,

 

I have the following data.

I want to create a measure that calculates Customer A's sale as 100 when user selects Jan 1 on slicer and 220 if user selects date range between 1st and 2nd Jan.

I tried taking the sum of averages, but it didn't work.

Please help me on this.

 

 

Regards,

Jos 

  • Jos13 

     

    Try the below DAX measure.

     

    Measure1 =
    VAR _x =
        SUMMARIZE ( 'Table', 'Table'[Date], 'Table'[Customer], 'Table'[Sale] )
    VAR _sum =
        SUMX ( _x, [Sale] )
    RETURN
        _sum

     

     

     




    Regards,
    Nandu Krishna

    Did I answer your question? Mark my post as a solution!
    Appreciate with a kudos 👍

    Proud to be a Super User!

3 Replies

  • nandukrishnavs's avatar
    nandukrishnavs
    Community Champion

    Jos13 

     

    Try the below DAX measure.

     

    Measure1 =
    VAR _x =
        SUMMARIZE ( 'Table', 'Table'[Date], 'Table'[Customer], 'Table'[Sale] )
    VAR _sum =
        SUMX ( _x, [Sale] )
    RETURN
        _sum

     

     

     




    Regards,
    Nandu Krishna

    Did I answer your question? Mark my post as a solution!
    Appreciate with a kudos 👍

    Proud to be a Super User!

  • that solution worked for me, it's very good, and it's the equivalence of "DISTINCT" in SQL