Forum Discussion

Anno2019's avatar
Anno2019
Helper IV
6 years ago
Solved

how to use Calculate function in combination with values function

Hi Guru's

 

I use the following formula which returns the "Total Pieces if Trend = "WON".

I need to add Value function so that it only looks in "Customer Name".  Not sure how to do this.

Total Pieces = 
CALCULATE(

    [pieces SUM],
    KEEPFILTERS(
        [Trend]="WON")
)
  • Hi Anno2019 

     

    Use SUMMARIZE('MainTable', 'MainTable'[Customer Name]) will create a new table with just the customers in. You can then add separate calculated columns to replace the measures you have. If you need to you can add aggregations in the SUMMARIZE. It will make that statement more complicated to follow. I like breaking things out into separate calculated columns so you can test each individual DAX statement.

     

    See how you get on, if you get stuck let us know

     

    Thanks, Brian

9 Replies

  • Hey,

     

    I can't quite follow what you mean.

     

    Can you provide a mock up of what you want to see (screen shot of an excel representation or something similar) and a screen shot of the table with [Trend] and [customer name].

     

    Thanks, Brian

  • bpsearle 

    Thanks for the reply.

     

    The my data is on an invoice level, I need this formula to calculate @ a customer level only using the [customer name].

    Not sure if that makes sense.  or is this a given and I don't have to try and aggregate at a customer level at all?

    • bpsearle's avatar
      bpsearle
      Resolver II

      Hi Anno2019 

       

      Put it this way, if I could mock-up what you have then I could test the solution and give you the answer with an explanation as to how it works so you can build your understanding. I can’t do that without knowing what data you have and what you are trying to achieve. A screen shot of what you want and a screen shot of your data would help.

       

      Thanks, Brian