cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Line Chart to Display Selected Year and Year Before Only

Hi all, I'm trying to see if it will be possible to do the following:

 

I have data from years 2014 to 2018. Years are displayed on a slicer which filters data for all visuals on a page.

One visual in particular is a Line Chart which displays the value of a measure by year (legend) and by month (X axis).

Behavior I'd like to implement is have this chart show the values for selected year and year before, i.e.:

- Selecting 2017, it would show the lines for 2017 and 2016.

- Selecting 2018 would show 2018 and 2017.

- 2014 would show 2014 only since no data is available in 2013.

 


Capture.PNG

 

Current workaround is having a mutli-selectable slicer and users manually select the 2 years to compare, however that is not user friendly as it affects all other visuals on the page as well, showing the values for the 2 combined years instead of the year being analyzed.

Meausre being displayed on line chart is a simple addition of 2 columns.

 

Been trying to play with filters and calculates for a while now but I can't find a way that would work. Help would be hugely appreciated!

2 ACCEPTED SOLUTIONS
Microsoft
Microsoft

@WDarwish,

Please check my reply in the following similar thread.
http://community.powerbi.com/t5/Desktop/undefined/td-p/164930

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

@WDarwish,

You would need to create two year slicers. One to filter the Line chart, and the other to filter the rest of visuals. And you can use "Edit interactions" feature to control how to filter the visuals with two slicers.

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Frequent Visitor

@v-yuezhe-msft,

 

Wanted to check if you had a chance to check my question please.

 

I have been trying to integrate this with the rest of the page and visuals, without success. I can share the file with you directly if you'd like to try it out, or if it not doable please let me know so I can relay that response.

 

Your help is truly apreciated!

@WDarwish,

You would need to create two year slicers. One to filter the Line chart, and the other to filter the rest of visuals. And you can use "Edit interactions" feature to control how to filter the visuals with two slicers.

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Microsoft
Microsoft

@WDarwish,

Please check my reply in the following similar thread.
http://community.powerbi.com/t5/Desktop/undefined/td-p/164930

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

@v-yuezhe-msft,

 

Thanks! indeed it has worked as expected!

 

Is there a way I could integrate this with the rest of the page? I have a year slicer already existing, which filters data for multiple other visuals. The dream scenario would be to have one single slicer controlling the whole page (i.e. this line chart as well as several other pie charts, bar charts, etc.) so that, for example, if 2017 is selected, the above line chart shows comparison between 2017 and 2016, while the other visuals on the page show data for 2017 only.

 

This is how the whole page looks like:

Capture.PNG

Helpful resources

Announcements
secondImage

Happy New Year from Power BI

This is a must watch for a message from Power BI!

December Update

Check it Out!

Click here to read more about the December 2020 Updates!

Community Blog

Check it Out!

Click here to read the latest blog and learn more about contributing to the Power BI blog!

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors
Top Kudoed Authors