Forum Discussion
Evolution rate for the current period
- 2 years ago
Hi Jackisover ,
If you add a column with the identification of the previous year you can have that value.
In the Calendrier table add the following column:
IsPast = VAR LastSaleDate = MAX ( 'Data test'[Date] ) VAR LastSaleDatePY = EDATE ( LastSaleDate, -12 ) RETURN 'calendrier'[Date] <= LastSaleDatePYNow change your measure to the following code:
Volume N-1 VAR = calculate([Volume N],SAMEPERIODLASTYEAR(calendrier[Date]), calendrier[IsPast] = TRUE())If you use this measure instead of the other on the calculation you will get what is expected:
The full explanation is on this blog post.
https://www.sqlbi.com/articles/previous-year-up-to-a-certain-date/
PBIX File attach.
Hi Jackisover ,
If you add a column with the identification of the previous year you can have that value.
In the Calendrier table add the following column:
IsPast =
VAR LastSaleDate = MAX ( 'Data test'[Date] )
VAR LastSaleDatePY = EDATE ( LastSaleDate, -12 )
RETURN
'calendrier'[Date] <= LastSaleDatePY
Now change your measure to the following code:
Volume N-1 VAR =
calculate([Volume N],SAMEPERIODLASTYEAR(calendrier[Date]), calendrier[IsPast] = TRUE())
If you use this measure instead of the other on the calculation you will get what is expected:
The full explanation is on this blog post.
https://www.sqlbi.com/articles/previous-year-up-to-a-certain-date/
PBIX File attach.
- Jackisover2 years ago
Advocate I
This is so great MFelix, thank you so much for this solution, it was very difficult to me to find it !