cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ctalley13
Helper I
Helper I

Show only one line on a line chart until more are selected

Hello All, 

 

I have a scenario. Below you will find a visual of what I am facing. 

 

What I would like is for one line to show, and the rest to populate when a selection is made with a slicer.

 

I have two slicers, year and month.

 

Year slicer contains:

  • 2018
  • 2019
  • 2020
  • 2021
  •  

Month slicer contains:

  • January - Decemeber

 

beyond that, I am only using one key measure to display the % shown on the visual:

  • Viral Suppression % = DIVIDE('Historic Data'[Virally Suppressed Total],'Historic Data'[Virally Suppressed Count Total])

 

Is there a way I can just display one line on the visual and the rest remain hidden until a selection is made?

 

All the help is greatly appreciated. 

 

Thank you!

 

-Cody

Historic Rates.PNG

1 ACCEPTED SOLUTION

This should give you what you want - and it will even work with a single extra year too (sorry for the extra work on the sample data).  I had forgotten about ISFILTERED().

View solution in original post

15 REPLIES 15
lbendlin
Super User
Super User

use measures, one for each line, and set the measure result to BLANK() for the lines you want to hide.

Would I use if selected logic to create the measure? 

 

All the help is greatly appreciated.

 

Thank you! 

You would use ISFILTERED or compare with FILTERS .

Hello, 

 

would you mind providing a brief example of what one measure would look like? I was trying to figure it out myself and haven't been able to. 

all the help would be greatly appreciated. 

thank you!

Please provide sample data in usable format (not as a picture - maybe insert into a table?) and show the expected outcome.

I have provided a sample from the dataset I am using. the expected outcome would be to only show one year as a baseline (can be any year) and have it that no other years show until selected on the slicer.

 

the best basline I can provide is with the picture with my initial post. You will notice it is already very cluttered and it has been asked to show only one year until others are selected.

 

I appreciate all of your help. 

 

Thank you. 

So you would like to make 2019 the baseline and only show 2020 data as well if that year is selected?  And the baseline year should not be deselectable?

 

By the way, there's a small issue in Power BI. When nothing is selected in a slicer, everything is selected.  That means a slicer with a single value will always have that value selected, regardless of the toggle. That means in addition to the baseline we would need at least TWO other years.

 

attached file for illustration

So there is no way to have it only show one year and when the user wants to view other years / compare, they can use the slicer to populate them?

That's not what I said.  There is no way to show one year and then use a slicer to show one other year if that is the only other year available. It will work with two or more additional years.

For the sake of example, could I see how you did it again, but this time I have provided 3 years. I apologize in advance for the confusion and appreciate all of the help you have provided. 

This should give you what you want - and it will even work with a single extra year too (sorry for the extra work on the sample data).  I had forgotten about ISFILTERED().

View solution in original post

Thank you so much for your help. This is exactly what I envisined. 

 

So I can just keep on adding years and the funcitionaly will remain the same? 

 

Thank you! 

Yes.  one thing to consider is that the baseline year right now is hardcoded in Power Query.  Not sure if that's what you want going forward.

YearMonthVirally Suppressed TotalVirally Suppressed Count TotalUndetectable TotalUndetectable Count TotalMonth NumberViral Suppression %Not Virally Suppressed TotalNot Virally Suppressed %undetectable %
2020January121313269961326191.48%1138.52%75.11%
2020February1237134610111346291.90%1098.10%75.11%
2020March1249135210131352392.38%1037.62%74.93%
2020April1248135810141358491.90%1108.10%74.67%
2020May1251135810061358592.12%1077.88%74.08%
2020June1240135510021355691.51%1158.49%73.95%
2020July124413599981359791.54%1158.46%73.44%
2020August1261136910071369892.11%1087.89%73.56%
2020September1270137310261373992.50%1037.50%74.73%
2020October12791381104613811092.61%1027.39%75.74%
2020November12821386105213861192.50%1047.50%75.90%
2020December12961401107214011292.51%1057.49%76.52%
2019January112912509291250190.32%1219.68%74.32%
2019February113912659311265290.04%1269.96%73.60%
2019March114912749401274390.19%1259.81%73.78%
2019April116112789461278490.85%1179.15%74.02%
2019May116612809551280591.09%1148.91%74.61%
2019June118112979811297691.06%1168.94%75.64%
2019July119413139811313790.94%1199.06%74.71%
2019August119213229791322890.17%1309.83%74.05%
2019September120813279941327991.03%1198.97%74.91%
2019October1218133599713351091.24%1178.76%74.68%
2019November1222133699913361191.47%1148.53%74.78%
2019December1228133899413381291.78%1108.22%74.29%
2018January104311958071195187.28%15212.72%67.53%
2018February105412068131206287.40%15212.60%67.41%
2018March105512138081213386.97%15813.03%66.61%
2018April105012018071201487.43%15112.57%67.19%
2018May106312078211207588.07%14411.93%68.02%
2018June106712028221202688.77%13511.23%68.39%
2018July106511958391195789.12%13010.88%70.21%
2018August108312048611204889.95%12110.05%71.51%
2018September110412328841232989.61%12810.39%71.75%
2018October1124125589412551089.56%13110.44%71.24%
2018November1139126891412681189.83%12910.17%72.08%
2018December1126125791012571289.58%13110.42%72.39%

YearMonthVirally Suppressed TotalVirally Suppressed Count TotalUndetectable TotalUndetectable Count TotalMonth NumberViral Suppression %Not Virally Suppressed TotalNot Virally Suppressed %undetectable %
2020January121313269961326191.48%1138.52%75.11%
2020February1237134610111346291.90%1098.10%75.11%
2020March1249135210131352392.38%1037.62%74.93%
2020April1248135810141358491.90%1108.10%74.67%
2020May1251135810061358592.12%1077.88%74.08%
2020June1240135510021355691.51%1158.49%73.95%
2020July124413599981359791.54%1158.46%73.44%
2020August1261136910071369892.11%1087.89%73.56%
2020September1270137310261373992.50%1037.50%74.73%
2020October12791381104613811092.61%1027.39%75.74%
2020November12821386105213861192.50%1047.50%75.90%
2020December12961401107214011292.51%1057.49%76.52%
2019January112912509291250190.32%1219.68%74.32%
2019February113912659311265290.04%1269.96%73.60%
2019March114912749401274390.19%1259.81%73.78%
2019April116112789461278490.85%1179.15%74.02%
2019May116612809551280591.09%1148.91%74.61%
2019June118112979811297691.06%1168.94%75.64%
2019July119413139811313790.94%1199.06%74.71%
2019August119213229791322890.17%1309.83%74.05%
2019September120813279941327991.03%1198.97%74.91%
2019October1218133599713351091.24%1178.76%74.68%
2019November1222133699913361191.47%1148.53%74.78%
2019December1228133899413381291.78%1108.22%74.29%

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power BI October Update 2021.jpg

Power BI Release

Click here to read more about the October 2021 Release!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Teds Dev Camp Oct. 2021 768x460.jpg

Power BI Dev Camp - October 28th, 2021

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

Top Solution Authors