Forum Discussion
Slicer default option
- 7 years ago
Hi Anonymous,
Based on your sample, I found that the issue is caused by the measure Final Selection your created.
If you use values function it will return mutiple values which will cause this error.
Please modify your measure like below to have a try.
Final Selection = SWITCH(TRUE(), SELECTEDVALUE(Selection[Option])= "Sales", [Total Internet Sale], SELECTEDVALUE(Selection[Option])= "Profits", [Total Internet Profit], 0)Best Regards,
Cherry
- 7 years ago
GOOD NEWS!! The Power BI March 2019 Update just released a custom visual called the "Power Slicer" you can import this visual from the marketplace. This visual has a million more options than the normal slicer and more importantly allows you to set a default value. This can be done by going into the format tab under the "selection" options and setting the default value to a literal in your list.
For example if you had a power slicer with a bunch of years in it:
.2015
.2016
.2017
.2018
.2019You can set "Default Selection" to be "2019"(minus the quotes). But if you want it to be dynamic and always show the current year, then even more good news, this options accepts javascript, so you can set the "Default Selection" to "(new Date()).getFullYear"(minus the quotes) and the Default will always be the current year. If you have a more specific need you can always google it for some javascript help, and someone on StackOverflow will probably have your answer.
Heres a link to the video (Skip to 14:43): https://www.youtube.com/watch?v=rBPGH6eYlT0&feature=youtu.be&t=10
Hope this helps,Xonde.
I am using AdventureWorksDW data samples.
You can find the report in the attachment.
I thank you in advance for your help
Hi Anonymous,
Based on your sample, I found that the issue is caused by the measure Final Selection your created.
If you use values function it will return mutiple values which will cause this error.
Please modify your measure like below to have a try.
Final Selection = SWITCH(TRUE(),
SELECTEDVALUE(Selection[Option])= "Sales", [Total Internet Sale],
SELECTEDVALUE(Selection[Option])= "Profits", [Total Internet Profit], 0)
Best Regards,
Cherry
- Anonymous7 years agoNot applicable
v-piga-msft
Thank you so much. I can't believe this could have been solved so easily !!!:smileyindifferent:
This is exactly the equivalent for the :Option Select = IF ( HASONEVALUE ( Selection[Option] ), VALUES ( Selection[Option] ), MAX ( InternetSales[SalesAmount] ) )Thank you for your clever answer