• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Power Query - change year accordingly

Cele

Member
Hi,
Please see sample report attached.
Say I am in the year 2018, how do i filter this report so it only shows 2018, automatically? Without me having to go in and filter manually?
Please advise.

Thanks,

Cele
 
Hi,
Please see sample report attached.
Say I am in the year 2018, how do i filter this report so it only shows 2018, automatically? Without me having to go in and filter manually?
Please advise.

Thanks,

Cele
I don't see any attachment of files. Could you please load the file?
 
this webpage is not allowing to upload. When I click the upload file nothing happens...
Here you go for upload a file. Once you select the file it will automatically load/take it.
 

Attachments

  • Instruction to load file.docx
    119.8 KB · Views: 1
@Cele I am not sure why you are not able to attach files. It could be a problem with your browser / firewall / network or computer policies.

You can filter latest data by
  • select data column, click on filter icon. Go to Date filters > year > this year
  • Alternatively, define a year as parameter. Set value to 2017. Use this parameter in year filter. Change parameter when you want to change filter.
 
Without looking at your file, here's general method employed in PowerQuery.

1. Add helper column which is used as filter flag. Assuming your date column is in datetime type.
Code:
= Date.Year([your date column]) = Date.Year(DateTime.LocalNow())

2. Filter on the added column to remove "FALSE".

You can then load the data on to worksheet or into data model. It will always filter for current year.

Another method, if you are bringing in data from SQL database, is to use native query to filter data before being brought into PQ.
 
Back
Top