Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Sander1401
Helper II
Helper II

Last 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

1 ACCEPTED SOLUTION
Ahmedx
Super User
Super User

you need to create a column in the calendar tableScreenshot_1.png

View solution in original post

4 REPLIES 4
ThxAlot
Super User
Super User

Simple enough,

ThxAlot_0-1713210342962.png

But bear in mind, this measure is single-purposed and used only by itself.



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



Ahmedx
Super User
Super User

you need to create a column in the calendar tableScreenshot_1.png

ahoggatt42
Regular Visitor

Have you tried a measure:

 

Test = CALCULATE(LASTDATE(*Date*),WEEKDAY(*Date*,1)=1)

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.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Users online (6,781)