Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

How to Rank between Weeks

Hello friends.

 

Today I stock with a situation, I need to rank the changes between 2 weeks.

 

I have a sales tables, where for example:

 

For week 30 I have on the top 3 items:

 

Cheese = 30$  

Pencil = 25$

Pen = 20$

 

But

for week 31 

Pencil = 30$

Pen = 28$ 

Cheese 25$

 

So I need to rank the changes between the weekends, If so, the cheese drop down 2 steps, the pencil rank up 1 step and the Pen had the same behavior.

 

I created to calculated measures, where I compare the sales between weeks, but I can´t do it with rank

 

Unidades Vendidas hasta el momento = SUM(

    'Detalle Productos'[Cantidad])
Unidades de Producto Semana Anterior = 

    CALCULATE([Unidades Vendidas Productos],

        FILTER(ALL('Calendar'),

            'Calendar'[Year] = SELECTEDVALUE('Calendar'[Year]) &&

            'Calendar'["#WeekNum"] = SELECTEDVALUE('Calendar'["#WeekNum"]) - 1)

)
Diferencias = 

 [Unidades Vendidas Productos] - [Unidades de Producto Semana Anterior]

 

 

 

1 Reply