Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Anonymous
Not applicable

Help!! year filter

Hi, i need help with this stuff. I have 2 graphics where  i need to show the current year in one graphic, and the previus year in the other, but i also have a filter of year. How can i show this?

Captura.JPGCaptura1.JPG

2 ACCEPTED SOLUTIONS
edhans
Super User
Super User

The easiest way is to apply a filter to the specific visuals.

  1. Make sure the filter pane is visible. Select the View ribbon and Filter button if it isn't.
  2. Select the visual you want.
  3. For the date in the visual, select as shown below for the current year. Relative Date filtering is the key here.
  4. Repeat for the other visual, but change it to show "In the last", then 1, then "Calendar year." If you don't change it to "Calendar year" it will give you the last 12 months effectively.

 

20200205 12_39_51-relative date filter.png

 

BTW, the other solutions provided that talk about date tables and measures is really the way I would prefer to handle it, but applying visual filters can be the fastest, but it will only solve the problem for specific visuals and not provide the other advantages the measures will do once you have a real Date table in your model.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

Tad17
Solution Sage
Solution Sage

Hey @Anonymous 

 

This is what you are looking for: https://docs.microsoft.com/en-us/dax/sameperiodlastyear-function-dax

 

Alternatively, you can create another sliver and edit the interations so that one slicer interacts with one visual and the other with the other so that you can show two separate years of your choice according to the two slicers: https://docs.microsoft.com/en-us/power-bi/service-reports-visual-interactions

 

I have used both methods depending on the needed final result.

View solution in original post

3 REPLIES 3
TomMartens
Super User
Super User

Hey @Anonymous ,

 

this site contains almost anything one has to know about time intelligence and Power BI or better DAX:

https://www.daxpatterns.com/time-patterns/

 

It is essential that you create a calendar table, relate the date column of the calendar table to the fact table.

Use the year columns from the calendar table in your visuals, the slicer and the months.

 

Create a measure that calculates the previous year value and use this measure in the visual that shows the previous year values.

 

Hope this will help to tackle your challenge.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany
Tad17
Solution Sage
Solution Sage

Hey @Anonymous 

 

This is what you are looking for: https://docs.microsoft.com/en-us/dax/sameperiodlastyear-function-dax

 

Alternatively, you can create another sliver and edit the interations so that one slicer interacts with one visual and the other with the other so that you can show two separate years of your choice according to the two slicers: https://docs.microsoft.com/en-us/power-bi/service-reports-visual-interactions

 

I have used both methods depending on the needed final result.

edhans
Super User
Super User

The easiest way is to apply a filter to the specific visuals.

  1. Make sure the filter pane is visible. Select the View ribbon and Filter button if it isn't.
  2. Select the visual you want.
  3. For the date in the visual, select as shown below for the current year. Relative Date filtering is the key here.
  4. Repeat for the other visual, but change it to show "In the last", then 1, then "Calendar year." If you don't change it to "Calendar year" it will give you the last 12 months effectively.

 

20200205 12_39_51-relative date filter.png

 

BTW, the other solutions provided that talk about date tables and measures is really the way I would prefer to handle it, but applying visual filters can be the fastest, but it will only solve the problem for specific visuals and not provide the other advantages the measures will do once you have a real Date table in your model.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.