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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

How to create calculated column for due dates due within next 7 days

Good Morning Power Bi Users! 

 

I would like to create a visual for my metric showing all items that are due within next 7 days.

 

As per below it looks like you cannot add an expression into the value.

KeeganClarke_0-1696934002963.png

Any ideas?

 

Thanks,

 

1 ACCEPTED SOLUTION
BA_Pete
Super User
Super User

Hi @Anonymous ,

 

The first issue is that TODAY() is a DAX function but Power Query uses the M language.

In Power Query, go to the Add Column tab > Custom Column and paste in this code:

 

let __todayDate = Date.From(DateTime.LocalNow()) in
if [Due Date] >= __todayDate and [Due Date] <= Date.AddDays(__todayDate, 7) then "Due within 7 days"
else "Not due within 7 days"

 

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

4 REPLIES 4
BA_Pete
Super User
Super User

Hi @Anonymous ,

 

The first issue is that TODAY() is a DAX function but Power Query uses the M language.

In Power Query, go to the Add Column tab > Custom Column and paste in this code:

 

let __todayDate = Date.From(DateTime.LocalNow()) in
if [Due Date] >= __todayDate and [Due Date] <= Date.AddDays(__todayDate, 7) then "Due within 7 days"
else "Not due within 7 days"

 

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Anonymous
Not applicable

Hi Pete, 

As suggested copied and pasted the formula and now getting the below error:

KeeganClarke_0-1696937802306.png

Thanks for the help.

 

 

I missed a space in the second [Due Date].

I've updated my original answer to correct. Please try now.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Anonymous
Not applicable

You legend! Thats worked. Thank you very much for the help!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors