0
votes

I have a question regarding selecting specific dates on table.

I have the following table:

Date Total orders
2021_02_01 1000
2021_01_01 900
2020_12_01 800
2020_11_01 700
2020_10_01 600
2020_09_01 500
... ...
2020_04_01 90
2020_03_01 80
2020_02_01 70
2020_01_01 50
... ...
2019_01_01 40

I have parameter so the user can select a date of interest.

I am trying to create a DAX measure that takes calculates the difference in total orders over the years starting on the chosen date.

For example, if 2021_01_01 is selected, the measure will return:

year value
2021 950 (1000(2021_01_01)-50 (2020_01_01))
2020 10 (50 (2020_01_01) - 40 (2019_01_01))

and so on for all the data existing in the table

Thank you very much for your help!

1

1 Answers

0
votes

This looks to me like something that could better be calculated in the source of the data, for example in SQL using a join.