Deepsee - Functions with Time

Hi everybody, 

I have to create a pivot that shows the result comparing the last week of the current date with the last week of the last year in the same month. I tried using the function LAG, but didn´t work.  Works only if I want to compare the months between the two years.  If someone has some idea, i will appreciatte a lot. 


Jaqueline Krieger


Hi Jaqueline,

This Developer Community post has some information that you may find useful:

It deals specifically with comparing results for this year to date versus the same time period in the previous year, but you might be able to apply some of the same concepts when writing your MDX expressions. Let me know if you need clarification, or if this doesn't enable you to make the calculations you intend.


Sam Duncan

Hi Jaqueline,

Actually, it might be tricky to compare one week to another same week of the last year. The Same week may belong to different months for two different years. 

Anyway you may consider trying with WeekNumber function for Time dimensions having something like this (Samples, Holefoods):