Forum Discussion

bhmiller89's avatar
bhmiller89
Helper V
9 years ago
Solved

Filtered min function

I have production data that lists sales. I need to calculate Total Sales for anything other than the original sale. Example:

 

I have Sale Date, Sale Amount, Client Name

 

I was thinking somehow I need to use

 

DellProduction = CALCULATE([Sales Total], 'dpmgr vwJMWebSalesOpportunitiesProduction'[CloseDate] <> MINA('dpmgr vwJMWebSalesOpportunitiesProduction'[CloseDate]))

 

but keep getting an error

  • I too don't know what you mean by "other than the original sale", but I can tell you why you are getting an error.  The filter argument for your CALCULATE function cannot compare a column with a calculated value the way you have it set up.  It needs a hard coded value and could do it this way: 'dpmgr vwJMWebSalesOpportunitiesProduction'[CloseDate] <> "12/12/2016"

     

    Otherwise, you will need to wrap the MINA function in a VALUES function.  Additionally, you may need to wrap all this inside a FILTER function, but it is impossible to test without any sample data.

2 Replies

  • dkay84_PowerBI's avatar
    dkay84_PowerBI
    Microsoft Employee

    I too don't know what you mean by "other than the original sale", but I can tell you why you are getting an error.  The filter argument for your CALCULATE function cannot compare a column with a calculated value the way you have it set up.  It needs a hard coded value and could do it this way: 'dpmgr vwJMWebSalesOpportunitiesProduction'[CloseDate] <> "12/12/2016"

     

    Otherwise, you will need to wrap the MINA function in a VALUES function.  Additionally, you may need to wrap all this inside a FILTER function, but it is impossible to test without any sample data.

  • Mi2n's avatar
    Mi2n
    Microsoft Employee

    What do you mean by "anything other than the original sale". Can you provide sample data and some screenshots for better understanding your problem?