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! Learn more

Reply
Power007
Frequent Visitor

Assign a Date Value which is 30 days prior to Today

Hi Folks,

I'm a newbie needing help from gurus like you.

 

I need to add a column that assigns a date which is 30 days prior today based on a condition. I tried using Power Query Editor and below is what I have.  It's giving me ERROR for condition 1.

 

= Table.AddColumn(#"Added Conditional Column", "SystemDate 2", each if [BT Class 2] = "PRIORB" then Date.Day(-30) else [System Date])

 

I tried using Today() but also didn't work.

 

Thanks for your help.

1 ACCEPTED SOLUTION
ppm1
Solution Sage
Solution Sage

You can use this expression to get 30 days ago

 

Date.AddDays(Date.From(DateTime.LocalNow()), -30)

 

Pat

Microsoft Employee

View solution in original post

2 REPLIES 2
ppm1
Solution Sage
Solution Sage

You can use this expression to get 30 days ago

 

Date.AddDays(Date.From(DateTime.LocalNow()), -30)

 

Pat

Microsoft Employee
Power007
Frequent Visitor

Thank you very much. It worked like magic.

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