Power Query how to get dynamic month no. in a filter function

jccnz

New Member
Joined
May 28, 2019
Messages
13
Hi All, I'm new here.
I have a power query filter question, I want to filter the month as last year of this month (ie current month no.). I filtered the year but I want to make the month dynamic.
Using this filter function how to make Date.Month([Calendar]) = calculate as current month no.
= Table.SelectRows(#"Filtered Rows", each Date.Month([Calendar]) = 5)
Thanks
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
so your description isn't clear

= Table.SelectRows(#"Filtered Rows", each Date.Month([Calendar]) = 5)

Date.Month(DateTime.LocalNow()) will give you number of actual month = 5

so: = Table.SelectRows(#"Filtered Rows", each Date.Month([Calendar]) = Date.Month(DateTime.LocalNow()))

btw. value of Date.Month(DateTime.LocalNow()) is taken from the system date

maybe try explain more....
 
Last edited:
Upvote 0
It's magic !!!
rotfl2.gif


Have a nice day
 
Upvote 0
Hi again,
my reporting need to be today()-1 so when the end of the month for example 1st Jul, I still need to report 30th Jun, Date.Month(DateTime.LocalNow())) still need to be 6 not 7, how to - 1 day? in this statement?
Thanks
 
Upvote 0

Forum statistics

Threads
1,224,903
Messages
6,181,648
Members
453,059
Latest member
jkevin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top