Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Rank by date and quantity

Hello,

 

Im trying to make a que list by ranking order date and quantity that i will match with available quantity, so if i have 4 available units i will give those to the first 3 orders, since the third order in the example has ordered 2. I have managed to rank the orders by date but cant wrap my head around how to make it consider the quantity in each order.

 

Expected behaviour of the rank column:

Order idOrder dateproductquantityrank
2456772021-11-25 4567711
2467772021-11-26 4567712
2788992021-11-27 4567724
2946782021-11-28 4567715
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous ,

    Please have a try.

    Create a measure.

    Measure = CALCULATE(SUM('Table'[quantity]),FILTER(ALL('Table'),'Table'[Order date]<=MAX('Table'[Order date])))

    Best Regards

    Community Support Team _ Polly

     

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

2 Replies

  • Anonymous , This seem like cumulative Qty

    new measure

    =sumx(filter( allselected(Table), Table[Date] <= max(Table[Date]) ), [Quantity] )

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    Please have a try.

    Create a measure.

    Measure = CALCULATE(SUM('Table'[quantity]),FILTER(ALL('Table'),'Table'[Order date]<=MAX('Table'[Order date])))

    Best Regards

    Community Support Team _ Polly

     

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