Forum Discussion

AlexanderAT's avatar
AlexanderAT
Helper I
7 years ago
Solved

Sumx with date filter

Hello everyone

 

I need to know the first 3 days turnover pr. customer in order categorizes them later. 

is it possible to create a column with this number? 

 

Sample data below: 

 

Kind regards 

Alexander

  • Hi AlexanderAT ,

     

    You can create columns like DAX below.

     

    Rank = CALCULATE(COUNT(Table1[price]),FILTER(ALLSELECTED(Table1),Table1[Customer_Id]=EARLIER(Table1[Customer_Id])&&Table1[order_date]<=EARLIER(Table1[order_date])))

     

    Top 3 days turnover= CALCULATE(SUM(Table1[price]),FILTER(ALLSELECTED(Table1),Table1[Customer_Id]=EARLIER(Table1[Customer_Id])&&Table1[Rank]<=3))

     

    Best Regards,

    Amy

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

2 Replies

  • v-xicai's avatar
    v-xicai
    Community Support

    Hi AlexanderAT ,

     

    You can create columns like DAX below.

     

    Rank = CALCULATE(COUNT(Table1[price]),FILTER(ALLSELECTED(Table1),Table1[Customer_Id]=EARLIER(Table1[Customer_Id])&&Table1[order_date]<=EARLIER(Table1[order_date])))

     

    Top 3 days turnover= CALCULATE(SUM(Table1[price]),FILTER(ALLSELECTED(Table1),Table1[Customer_Id]=EARLIER(Table1[Customer_Id])&&Table1[Rank]<=3))

     

    Best Regards,

    Amy

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.