Forum Discussion
aatish178
2 years agoHelper IV
Not able to filter the data based on dynamic where condition
Hi Team, I am new to power bi., here I have loaded a date field from the table, now I want to dynamically filter the date based on last one year date from today's date and the filter should be dynam...
- 2 years ago
Hi, add this as a new step:
Replace Source with your previous step reference and [Date] with your [Column Name]
= Table.SelectRows(Source, each [Date] >= Date.AddYears(Date.From(DateTime.FixedLocalNow()), -1) )Whole sample code:
let Source = Table.FromList(List.Dates(Date.AddDays(Date.From(DateTime.LocalNow()), -730), 1000, #duration(1,0,0,0)), Splitter.SplitByNothing(), type table[Date=date]), FilteredRows = Table.SelectRows(Source, each [Date] >= Date.AddYears(Date.From(DateTime.FixedLocalNow()), -1) ) in FilteredRows
dufoq3
2 years agoCommunity Champion
Hi, add this as a new step:
Replace Source with your previous step reference and [Date] with your [Column Name]
= Table.SelectRows(Source, each [Date] >= Date.AddYears(Date.From(DateTime.FixedLocalNow()), -1) )
Whole sample code:
let
Source = Table.FromList(List.Dates(Date.AddDays(Date.From(DateTime.LocalNow()), -730), 1000, #duration(1,0,0,0)), Splitter.SplitByNothing(), type table[Date=date]),
FilteredRows = Table.SelectRows(Source, each [Date] >= Date.AddYears(Date.From(DateTime.FixedLocalNow()), -1) )
in
FilteredRows