Forum Discussion
Allow user to select values to be shown?
- 10 years ago
cmacdo wrote:
That actually looks like exactly what I need, but I'm going to need to play with it to get it to work for my needs and in PowerBI. The user is probably only going to want to be able to view one line at a time anyways, so one slicer should be enough. If you have any more detailed instructions that would be extremely helpful! Thanks so much!
To view one line at a time, you can create a table with one column valuing measures names. And filter the measures names in a slicer. In the line chart, put the a measure similar to below.
MeasureShown = IF ( HASONEVALUE ( 'MeasureNameTable'[MeasureName] ), ( SWITCH ( LASTNONBLANK ( 'MeasureNameTable'[MeasureName], "blank" ), "Measure1", [Measure1], [Measure2] ) ), [DefaultMeasure] )
You can't add or remove measures with a slicer. However if you have a fixed number of measures in a chart, you can swap "which" measures are displayed. Read this article I wrote some time ago.
http://www.powerpivotpro.com/2014/10/5-interactive-chart-techniques-come-together/
That actually looks like exactly what I need, but I'm going to need to play with it to get it to work for my needs and in PowerBI. The user is probably only going to want to be able to view one line at a time anyways, so one slicer should be enough. If you have any more detailed instructions that would be extremely helpful! Thanks so much!
- MattAllington10 years agoCommunity Champion
The workbook I used is attached to the blog post. You can download it to see what I did
- Eric_Zhang10 years agoMicrosoft Employee
cmacdo wrote:
That actually looks like exactly what I need, but I'm going to need to play with it to get it to work for my needs and in PowerBI. The user is probably only going to want to be able to view one line at a time anyways, so one slicer should be enough. If you have any more detailed instructions that would be extremely helpful! Thanks so much!
To view one line at a time, you can create a table with one column valuing measures names. And filter the measures names in a slicer. In the line chart, put the a measure similar to below.
MeasureShown = IF ( HASONEVALUE ( 'MeasureNameTable'[MeasureName] ), ( SWITCH ( LASTNONBLANK ( 'MeasureNameTable'[MeasureName], "blank" ), "Measure1", [Measure1], [Measure2] ) ), [DefaultMeasure] )- cmacdo10 years agoMicrosoft Employee
This actually works extremely well, thank you so much! Just one more question, is there anyway to have this work with the original data being from direct query? I can't seem to find a way to create the MeasureNameTable without having to switch to import. I guess I can just set up data refresh, but seems like it should be unnecessary since my original data is from an Azure SQL table.
- Eric_Zhang10 years agoMicrosoft Employee
Up to my knowledge, no way in direct query to create a table. Maybe import a MeasureNameTable from SQL Azure DB?
- Anonymous3 years agoNot applicable
This looks exactly what i need, do you have an exemple ou a tutorial of how you applied this?