Forum Discussion

san17680's avatar
san17680
Icon for Helper II rankHelper II
3 years ago
Solved

Average Sales Per customer not working

Hi All,

i have tried to get avg sales per cust, but its not working, it somehow shows total sales.

here is my formula

AVG SALES PER CUST = AVERAGEX(VALUES(Customer[Customer]),SUM(Sales_data[Sales Amount]))
i also tried,  
AVG SALES PER CUST = AVERAGEX(VALUES(Customer[Customer]),CALCULATE(SUM(Sales_data[Sales Amount])))
it did not work as well.

 

Thanks

  • mlsx4's avatar
    mlsx4
    3 years ago

    But total sales measure sums the values as in option 2, isn't it?

    Then, it wouldn't be possible to achieve result in 1

10 Replies

  • mlsx4's avatar
    mlsx4
    Icon for Memorable Member rankMemorable Member

    Hi san17680 

     

    Change the sum of the calculate by the average:

     

    AVG SALES PER CUST = AVERAGEX(VALUES(Customer[Customer]),CALCULATE(AVERAGE(Sales_data[Sales Amount])))

    • san17680's avatar
      san17680
      Icon for Helper II rankHelper II

      Thanks for your response

      when i calculate 

      AVG SALES PER DAY = AVERAGEX(VALUES('Calendar'[Date]),[TOTAL_SALES])
      I use sales measure
      why do we use average inside averagex as you suggested,
       
      i thought averagex would iterate on each customers sales and then average all of the rows in the formula [AVG SALES PER CUST = AVERAGEX(VALUES(Customer[Customer]),SUM(Sales_data[Sales Amount]))]?
      is this correct understanding?
       
      Thanks
      • mlsx4's avatar
        mlsx4
        Icon for Memorable Member rankMemorable Member

        Hi san17680 

         

        You need first to calculate the average for each customer (AVG inside the calculate) and then if you want the average for the whole column, then you need to use AVERAGEX which will evaluate the expression row by row. If you sum, it will compute the SUM for each customer and later on, the AVERAGEX will compute the average over that sum.

         

        Sorry in advance if I haven't explained it clearly