cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

Calculate a measure based on the aggregation of a sales column

 

I want to create a measure to distinct count the CLIENT_ID if the aggregation of the sales column is greater than 0.

 

I used to create a calculated column to bring me 1 if the sales where greater than 0, else it would bring me 0.

 

So it would look like: CALCULATE(DISTINCTCOUNT(CLIENT_ID)); [CALCULATEDCOLUMN] = 1)

 

But, as it turns out, even if the aggregate total is not greater than 1, it would still count the CLIENT_ID, because in the first and the last row for example, the sales would be greater than 0.

 
 

Sem título.png

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User IV
Super User IV

Re: Calculate a measure based on the aggregation of a sales column

Measure =

COUNTROWS(

  DISTINCT(

  SELECTCOLUMNS(

  FILTER(

    SUMMARIZE(

      'Table',

      [CLIENT_ID],

      "__Sum",SUM('Table'[LIQUID_SALES])

    ),

    [__Sum] > 1

  ),

  "__Client",[CLIENT_ID]

  )

  )

)


---------------------------------------

Putting square pegs in round holes since 1972.

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

1 REPLY 1
Highlighted
Super User IV
Super User IV

Re: Calculate a measure based on the aggregation of a sales column

Measure =

COUNTROWS(

  DISTINCT(

  SELECTCOLUMNS(

  FILTER(

    SUMMARIZE(

      'Table',

      [CLIENT_ID],

      "__Sum",SUM('Table'[LIQUID_SALES])

    ),

    [__Sum] > 1

  ),

  "__Client",[CLIENT_ID]

  )

  )

)


---------------------------------------

Putting square pegs in round holes since 1972.

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

Helpful resources

Announcements
Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Galleries

Galleries

Looking for inspiration on how to present your data? Need instructional videos? Check out our Galleries!

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors