Forum Discussion
Time Intelligence functions
Hi,
I have very simple data and wanted to write dax for some time intelligence functions like as YTD, LYTD, Last 12 months rolling, sameperiodlastyear.
I have filters as Year and Month.
When I select Year 2022 and Month Mar my results should be
CurrentMonth= Revenueactuals measure should be 2022March
YTD: Revenueactuals measure should 2022 Jan to 2022 March
LYTD: Revenueactuals measure should be 2021 Jan to 2021 March
Last 12 months rolling measure should be 2022 March to 2021 Apr
Sameperiodlastyear measure should be 2021 March.
If I select 2021 and April it should be done same as above. attached data set for your reference.
I tried implementing DAX, but that changes values based on my current selection and all measure balue showing selected year and month only.
| Sr No | Date | Revenue Actuals |
| 1 | 01/01/2021 | 1200 |
| 2 | 28/01/2021 | 400 |
| 3 | 15/01/2021 | 943 |
| 4 | 01/02/2021 | 432 |
| 5 | 28/02/2021 | 361 |
| 6 | 15/02/2021 | 1 |
| 7 | 01/03/2021 | 251 |
| 8 | 28/03/2021 | 746 |
| 9 | 15/03/2021 | 463 |
| 10 | 01/04/2021 | -598 |
| 11 | 28/04/2021 | 333 |
| 12 | 15/04/2021 | 456 |
| 13 | 01/05/2021 | 966 |
| 14 | 28/05/2021 | 202 |
| 15 | 15/05/2021 | 112 |
| 16 | 01/06/2021 | 973 |
| 17 | 28/06/2021 | 100 |
| 18 | 15/06/2021 | 742 |
| 19 | 01/07/2021 | 81 |
| 20 | 28/07/2021 | 978 |
| 21 | 15/07/2021 | 222 |
| 22 | 01/08/2021 | 232 |
| 23 | 28/08/2021 | 879 |
| 24 | 15/08/2021 | 918 |
| 25 | 01/09/2021 | 726 |
| 26 | 28/09/2021 | 645 |
| 27 | 15/09/2021 | 654 |
| 28 | 01/10/2021 | 916 |
| 29 | 28/10/2021 | 188 |
| 30 | 15/10/2021 | 291 |
| 31 | 01/11/2021 | 261 |
| 32 | 28/11/2021 | 943 |
| 33 | 15/11/2021 | 746 |
| 34 | 01/12/2021 | 674 |
| 35 | 28/12/2021 | 746 |
| 36 | 15/12/2021 | 734 |
| 37 | 01/01/2022 | 829 |
| 38 | 28/01/2022 | 746 |
| 39 | 15/01/2022 | 839 |
| 40 | 01/02/2022 | 753 |
| 41 | 28/02/2022 | 846 |
| 42 | 15/02/2022 | 273 |
| 43 | 01/03/2022 | 763 |
| 44 | 28/03/2022 | 957 |
| 45 | 15/03/2022 | 364 |
| 46 | 01/04/2022 | 847 |
| 47 | 28/04/2022 | 347 |
Appreciated your support.
Thanks,
3 Replies
- Ashish_MathurSuper User
- AnonymousNot applicable
Hi Ashish,
When I tried to create Sameperiod last year it is not giving the correct results.
Same selected Month and Year but Last Year:
CALCULATE(SUM(Amount),SAMEPERIODLASTYEAR(Date))
I am trying below requirement as well, but couldn't success.
YTD: My financial year starts from APRIL to MARCH when I selected 2022 and APRIL. I suppose to see 2022 APRIL to 2023 March. not sure how to get this done.
Last Year YTD: When I select 2022 APRIL then I supposed to see 2021 APRIL to 22 MARCH.
- Ashish_MathurSuper User
Hi,
I am not sure of what you want. Share some data and show the expected result.