Forum Discussion
Sander1401
Helper II
2 years agoLast Sunday in dataset
Hi all,
is there a way to calculate (DAX) the last Sunday of the dataset?
for example if the max date in the dataset is Monday 15-04-2024, I would like the date 14-04-2024. If the max date is 14-04-2024, then I would also like 14-04-2024.
Sander
you need to create a column in the calendar table
4 Replies
- ahoggatt42Regular Visitor
Have you tried a measure:
Test = CALCULATE(LASTDATE(*Date*),WEEKDAY(*Date*,1)=1)- Sander1401
Helper II
I will definitely try this one, thanks.
my own solution (not tested yet) is:
If (weekday(Max date, 2) = 7, max date, max date - weekday(Max date, 2))but yours looks more clear.
- Ahmedx
Super User
you need to create a column in the calendar table
- ThxAlot
Super User
Simple enough,
But bear in mind, this measure is single-purposed and used only by itself.