Forum Discussion

Sandeep13's avatar
Sandeep13
Helper III
2 years ago
Solved

Load data only latest to previous 18 months only

Hi All,

 

I have one csv file which contain data of last 3 years and its keep refreshing every week.

 

I want to show my reports only for latest to previous 18 months in all my reports and table matrix. 

 

I have column date INSERT_DT date in my dataset also I have created DATE tabel for other calculation to show(PQ, Previous months KPI) info.

 

Thanks

 

 

ExpertBM itexpert Abhi Bibi amitchandak need your help 

  • 1) add a column CutoffDate with the desired -18 months single date in Power Query
    2) filter your date (YourDateColumn) by the column CutoffDate
    3) remove the column CutoffDate

    #"Added Custom" = Table.AddColumn(PreviousStep, "CutoffDate", each Date.AddMonths(DateTime.LocalNow(), -18)),
    #"Filtered Rows" = Table.SelectRows(#"Added Custom", each [YourDateColumn] >= [CutoffDate]),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows", {"CutoffDate"}) in #"Removed Columns"

    Kudos and mark as solution appreciated.

3 Replies

  • 1) add a column CutoffDate with the desired -18 months single date in Power Query
    2) filter your date (YourDateColumn) by the column CutoffDate
    3) remove the column CutoffDate

    #"Added Custom" = Table.AddColumn(PreviousStep, "CutoffDate", each Date.AddMonths(DateTime.LocalNow(), -18)),
    #"Filtered Rows" = Table.SelectRows(#"Added Custom", each [YourDateColumn] >= [CutoffDate]),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows", {"CutoffDate"}) in #"Removed Columns"

    Kudos and mark as solution appreciated.

    • Sandeep13's avatar
      Sandeep13
      Helper III

      Do you have any sample .pbix file so i can take refernce or video ?

       

      As I am new to power bi.