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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Unable to create a custom column

I am trying to create custom column here which will basically allow me filter data for last 4 days dynamically.

Alice08_1-1732283434138.png

 

this is the query i am using but it is giving me error.

Data type of the modifiedon column is date/time.

2 ACCEPTED SOLUTIONS
DataInsights
Super User
Super User

@Anonymous,

 

Looks like you're missing a closing parenthesis at the end of the expression.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

Jai-Rathinavel
Super User
Super User

@Anonymous You can dynamically filter for last 4 days without even creating a calculated column, just paste the below expression at the last line of your M code inside Advance Editor, make sure you include a "," above the Filtered Rows expression like below

JaiRathinavel_1-1732285964590.png

 

 

 

#"Filtered Rows" = Table.SelectRows(#"Changed Type", each 
                       [YourDateColumn] >= Date.From(Date.AddDays(DateTime.LocalNow(),-4)) and 
                       [YourDateColumn] <=Date.From(DateTime.LocalNow()))
in 
#"Filtered Rows"

 

 

 

Did I answer your question? If yes, please mark my post as a solution. 

 

Thanks,

Jai




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous 

 

First of all, thanks to DataInsights and Jai-Rathinavel for their attention to this thread and great replies.

 

I would like to ask if the replies from DataInsights and Jai-Rathinavel have helped you to solve the problem? If so please consider accepting the helpful reply as a solution.

 

From the error message in your screenshot, it appears that “)” is missing from the end of your formula.
Here are some similar solved cases for your reference:

Solved: Date Filtering in Power Query - Microsoft Fabric Community

Solved: Filter As Per Last N Months, Current Month and Nex... - Microsoft Fabric Community

 

Best Regards,
Jarvis Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Jai-Rathinavel
Super User
Super User

@Anonymous You can dynamically filter for last 4 days without even creating a calculated column, just paste the below expression at the last line of your M code inside Advance Editor, make sure you include a "," above the Filtered Rows expression like below

JaiRathinavel_1-1732285964590.png

 

 

 

#"Filtered Rows" = Table.SelectRows(#"Changed Type", each 
                       [YourDateColumn] >= Date.From(Date.AddDays(DateTime.LocalNow(),-4)) and 
                       [YourDateColumn] <=Date.From(DateTime.LocalNow()))
in 
#"Filtered Rows"

 

 

 

Did I answer your question? If yes, please mark my post as a solution. 

 

Thanks,

Jai




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





DataInsights
Super User
Super User

@Anonymous,

 

Looks like you're missing a closing parenthesis at the end of the expression.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.