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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
PaulMac
Helper IV
Helper IV

Help with custom column

Hi

 

I need to produce a column at show true false for the previous sunday passed.

 

I have tried the below with now success. I some able to steer me onto the right track.

 

if [Day Name] = "Sunday" and [Date is in Future] = false and List.Max([Date]) = [Date] then true else false

 

Many thanks

Paul

1 ACCEPTED SOLUTION

Hi @PaulMac 

 

I'm not familiar with Power Pivot for Excel so I approached this with M code in Power Query. I think the logic is the same so you could refer to below codes. The key is that the duration between last Sunday and today is always less than 7 days (except that today is Sunday), so I add this to the criteria.

if [Day Name] = "Sunday" and [Date is in Future] = false and Duration.Days(Date.From(DateTime.LocalNow()) - [Date]) < 7 then true else false

121104.jpg

Kindly let me know if this helps.

Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help other members find it.

View solution in original post

4 REPLIES 4
PhilipTreacy
Super User
Super User

Hi @PaulMac 

Bit confused.  Your initial qs showed an M query from Power Query but then you said you are trying to do this in Power Pivot - which uses DAX?  

Any chance you can share some sample data and your expected result?

regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


amitchandak
Super User
Super User

@PaulMac , if you need in dax you can try like (New column )

 

if('Date'[date] ='Date'[Date]+-1*WEEKDAY('Date'[Date],1)+1, true(), false())

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi @amitchandak

I am doing this in Power Pivot for Excel and adjusted your DAX to suit my table and column names but this produces a new column that shows True for all Sundays in the tables. I would only like the last Sunday to have past to be a True value. so there should only be 1 True value returned.

Hi @PaulMac 

 

I'm not familiar with Power Pivot for Excel so I approached this with M code in Power Query. I think the logic is the same so you could refer to below codes. The key is that the duration between last Sunday and today is always less than 7 days (except that today is Sunday), so I add this to the criteria.

if [Day Name] = "Sunday" and [Date is in Future] = false and Duration.Days(Date.From(DateTime.LocalNow()) - [Date]) < 7 then true else false

121104.jpg

Kindly let me know if this helps.

Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help other members find it.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Solution Authors