geofspa
New Member
- Joined
- Jan 7, 2012
- Messages
- 30
- Office Version
- 365
- Platform
- Windows
Hi
I am really new to Power Query - please be gentle
I have been set a task to "automate" invoice target monitoring that can be updated, maybe weekly, that shows account controllers how close to achieving their monthly targets they are. The problem I am facing is the financial targets shown should only be for invoices due before the end of "This Month" but the data I am working with includes dates beyond this. Simply put is how can I dynamically filter in power query to only include everything before the beginning of next month.
Currently I have coded a hard filter for the begining of next month
= Table.SelectRows(TargetTotal, each [Due Date] < #date(2021, 3, 1))
Could the date here be dynamic?
I have a seperate query that contains calculation for the begining of next month
let
Source = DateTime.FixedLocalNow(),
#"Extracted Date" = Date.From(Source),
#"Converted to Table" = #table(1, {{#"Extracted Date"}}),
#"Changed Type" = Table.TransformColumnTypes(#"Converted to Table",{{"Column1", type date}}),
#"Inserted End of Month" = Table.AddColumn(#"Changed Type", "End of Month", each Date.EndOfMonth([Column1]), type date),
#"Changed Type1" = Table.TransformColumnTypes(#"Inserted End of Month",{{"End of Month", type number}}),
#"Added to Column" = Table.TransformColumns(#"Changed Type1", {{"End of Month", each _ + 1, type number}}),
#"Changed Type2" = Table.TransformColumnTypes(#"Added to Column",{{"End of Month", type date}}),
#"Removed Columns" = Table.RemoveColumns(#"Changed Type2",{"Column1"}),
#"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"End of Month", "Beginning Next Month"}})
in
#"Renamed Columns"
Could this be used to dynamicaly filter "Before Date"?
Hope this makes sense
Geof
I am really new to Power Query - please be gentle
I have been set a task to "automate" invoice target monitoring that can be updated, maybe weekly, that shows account controllers how close to achieving their monthly targets they are. The problem I am facing is the financial targets shown should only be for invoices due before the end of "This Month" but the data I am working with includes dates beyond this. Simply put is how can I dynamically filter in power query to only include everything before the beginning of next month.
Currently I have coded a hard filter for the begining of next month
= Table.SelectRows(TargetTotal, each [Due Date] < #date(2021, 3, 1))
Could the date here be dynamic?
I have a seperate query that contains calculation for the begining of next month
let
Source = DateTime.FixedLocalNow(),
#"Extracted Date" = Date.From(Source),
#"Converted to Table" = #table(1, {{#"Extracted Date"}}),
#"Changed Type" = Table.TransformColumnTypes(#"Converted to Table",{{"Column1", type date}}),
#"Inserted End of Month" = Table.AddColumn(#"Changed Type", "End of Month", each Date.EndOfMonth([Column1]), type date),
#"Changed Type1" = Table.TransformColumnTypes(#"Inserted End of Month",{{"End of Month", type number}}),
#"Added to Column" = Table.TransformColumns(#"Changed Type1", {{"End of Month", each _ + 1, type number}}),
#"Changed Type2" = Table.TransformColumnTypes(#"Added to Column",{{"End of Month", type date}}),
#"Removed Columns" = Table.RemoveColumns(#"Changed Type2",{"Column1"}),
#"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"End of Month", "Beginning Next Month"}})
in
#"Renamed Columns"
Could this be used to dynamicaly filter "Before Date"?
Hope this makes sense
Geof