Forum Discussion

AndySmith's avatar
AndySmith
Icon for Helper III rankHelper III
5 years ago

SUMX Formula with conditional SUMIF

Hi - I am trying to calculate 'points' for a sales incentive where points are awarded per number of products a customer purchases. 

 

Points = SUMX(VALUES('BrandPrint'[Customer Name]),CALCULATE(IF([New Listings Count]=0,0,IF(AND([New Listings Count]>=1,[Product Count]=4),12,[Product Count]*2))))

 

The totals - which work when calculated against a customner - does not total up correctly in a state summary. See screenshot below. Do i somehow need to incorporat ethe state into the SUMX formula?

 

Thanks

 

4 Replies

  • AndySmith , This because data is grouped to customer level and then do the calculation. So you grand total are calculated again using customer level

     

    For state you might have to do

    Points = SUMX(VALUES('BrandPrint'[State Name]),CALCULATE(IF([New Listings Count]=0,0,IF(AND([New Listings Count]>=1,[Product Count]=4),12,[Product Count]*2))))

    • AndySmith's avatar
      AndySmith
      Icon for Helper III rankHelper III

      Hoping to bump this to see if there may be a solution? 

       

      amitchandak - do you have any thoughts?

       

      Thanks

    • Ashish_Mathur's avatar
      Ashish_Mathur
      Icon for Super User rankSuper User

      Hi,

      In the first visual, the Points add up to 406 whereas they should add upto 408.  This measure gives the result as 408

      Measure = SUMX(Targets,[Points])
      Hope this helps.