Forum Discussion
noliverte
6 years agoHelper III
Total previous period dynamically
Hello, I have the following measure : Total Session LY all day = CALCULATE([Total Sessions-all];DATESBETWEEN(Calendrier[Calendar_Date];date(2019;01;01);date(2019;03;08))))) --> It works fi...
- 6 years ago
Thanks a lot it works fine, I jest adapt your code to fit to my problem.
Total Session LY all day = CALCULATE([Total Sessions-all];DATESBETWEEN(Calendrier[Calendar_Date];DATE(YEAR(TODAY())-1;1;1);DATE(YEAR(TODAY())-1;MONTH(TODAY());DAY(TODAY()-1))))Have a nice dayNoliverte
v-alq-msft
6 years agoCommunity Support
Hi, noliverte
Based on your description, I created data to reproduce your scenario.
Table:
Calendar(a calculated table):
Calendar = CALENDARAUTO()
Then you may create a measure as follows.
Total Session LY all day =
CALCULATE(
SUM('Table'[Sessions]),
DATESBETWEEN(
'Calendar'[Date],
DATE(YEAR(TODAY())-1,1,1),
TODAY()
)
)
Today is 3/10/2020. So the measure doesn't include sessions for 3/11/2020 and 3/31/2020. Here is the result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
noliverte
6 years agoHelper III
Thanks a lot it works fine, I jest adapt your code to fit to my problem.
Total Session LY all day = CALCULATE([Total Sessions-all];
DATESBETWEEN(Calendrier[Calendar_Date];
DATE(YEAR(TODAY())-1;1;1);
DATE(YEAR(TODAY())-1;MONTH(TODAY());DAY(TODAY()-1))
)
)
Have a nice day
Noliverte