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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

What is this code doing and is there a way to display the result without typing in Power Query

Hello everyone, i have a question. I am taking over a project from another developer and i dont quite understand what is this code doing even after referring to the https://docs.microsoft.com/en-us/powerquery-m/date-functions

 

Therefore, I also want to find out is there a way to display this result without typing into the power query editor. Thanks. 

 

#"Filtered Rows3" = Table.SelectRows(#"Filtered Rows1", each [Transaction Date] <= Date.EndOfWeek(Date.AddWeeks(Date.From(DateTime.LocalNow()), -1))),

 

Javierphang_0-1643086324390.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous,

In fact, these values aren't static values strings and they are dynamic calculation results based on M query/DAX functions. You cannot directly typing function string in the filter panel.
Regards,

Xiaoxin Sheng

View solution in original post

7 REPLIES 7
amitchandak
Super User
Super User

@Anonymous , filter data a week before

Date.From(DateTime.LocalNow()) // today date 

 

Date.AddWeeks(Date.From(DateTime.LocalNow()), -1) // a week before date

 

end of last week

Date.EndOfWeek(Date.AddWeeks(Date.From(DateTime.LocalNow()), -1))

 

so filtering date before last week end date.

 

You can do that dax, but you can create a flag column or a new tbale

 

 

Monday last week end date

Week End date = [Transaction Date]+ 7-1*WEEKDAY([Transaction Date],2) -7

Sunday last week end date

Week End date = [Transaction Date]+ 7-1*WEEKDAY([Transaction Date],1) -7

 

a new column

if([Transaction Date] <= [Week End date],1,0)

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
Anonymous
Not applicable

Thanks for the explanation.

Is there a way where can i can show the result visually instead of keying them into the power query? Thanks!

@Anonymous , not very clear, You can have last week end date in dax like

 

Monday last week end date

Week End date = [Transaction Date]+ 7-1*WEEKDAY([Transaction Date],2) -7

Sunday last week end date

Week End date = [Transaction Date]+ 7-1*WEEKDAY([Transaction Date],1) -7

 

 

power query like

Date.EndOfWeek(Date.AddWeeks(Date.From(DateTime.LocalNow()), -1)

 

what you mean by visually ?

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
Anonymous
Not applicable

Javierphang_0-1643086324390.png

Like this, where i dont really need to type in the advanced editor.

Anonymous
Not applicable

Hi @Anonymous,

In fact, these values aren't static values strings and they are dynamic calculation results based on M query/DAX functions. You cannot directly typing function string in the filter panel.
Regards,

Xiaoxin Sheng

Anonymous
Not applicable

Understood, Thanks!

Anonymous
Not applicable

Hi @Anonymous,

I'm glad to hear this helps. 🙂

BTW, power bi can only extract text values from this input panel so all the inputted 'characters' or 'function names' will be forced escapes /recognized as text values. That is the reason we had to do custom with the filter function itself instead of operating on the 'quick action' panel.

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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