Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi All,
We have below requirement in Power BI where Line chart should display data only in the case of single selection value in slicer. Please go through below cases:
When All is selected in slicer, Power BI Line chart should display empty.
When Multiple values are selected in above slicer, Power BI Line chart should display empty.
When single value is selected in above slicer, Chart should display corressponding data.
We are using Analysis services Live connection and we also need to keep multiple selections as enabled in slicer properties. Please let us know if we can accomplish this using DAX or by some other workaround.
Solved! Go to Solution.
Yep, all good with HASONEFILTER
Could you use
=IF( HASONEVALUE (SlicerTable[SlicerColumn] ), [Measure], BLANK() )
So, this looks interesting, but where does it go? Is this a measure? Do you add it to the table? How do you actually implement it?
Hi, it's a measure that replaces the one that would have been in your chart
Maybe I need to put in a new question. I have a table with some milestones across the top (x-axis), and organizations in the first column (x-axis). I have a slicer that allows me to select organizations, and then some cards display dates of achievement of the milestones. If I have selected none, or all, I would like the cards to all just display blanks.
Yes, probably best in future to post new thread (referencing this one) rather than adding to a solved one.
You would need to edit each measure in each card visual to be something like this, where the Slicer Table Slicer Column are your OrganisationTable[Org Name] that you are using in your slicer
=IF( HASONEFILTER(SlicerTable[SlicerColumn] ), [Measure], BLANK() )
I already tried this, but as per my understanding HASONEVALUE() on the basis of distinct values. But as it's a live connection to analysis servcies, there are many duplicate Job names for all the employees so HASONEVALUE function is returning data in chart in case of ALL is selected in slicer.
I have also tried HASONEFILTER() and this is working fine. I wanna double check in this case as I haven't used HASONEFILTER() previously. I just need to show data in case of single value in slicer is selected. Please update me with your suggestions if I am on a wrong track.
Hello @Anonymous
You can accomplish this using something like the following. In the measure below, the value I want to display is [Total Budget] but only if a single Dates[Year Month] is selected.
Amount Filtered = VAR SlicerSelection = SELECTEDVALUE( Dates[Year Month] ) RETURN IF ( NOT ISBLANK ( SlicerSelection ), [Total budget] )
VAR SlicerSelection = SELECTEDVALUE( Dates[Year Month] ) reads the selection of the Date[Year Month] column and returns a result only if a single month is selected. If more that one month is selected (including all months) SELECTEDVALUE( Dates[Year Month] ) returns BLANK. Then we check if our VAR is not blank, meaning a single month is selected, and if so return the [Total Budget] measure, otherwise return BLANK.
I already tried this. But as it's a live connection to analysis servcies, there are many duplicate Job names for all the employees so your above DAX is returning data in chart in case of ALL or multiple values are selected in slicer.
I have also tried HASONEFILTER() and this is working fine. I wanna double check in this case as I haven't used HASONEFILTER() previously. I just need to show data in case of single value in slicer is selected. Please update me with your suggestions if I am on a wrong track.
Yep, all good with HASONEFILTER
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
93 | |
85 | |
83 | |
71 | |
49 |
User | Count |
---|---|
142 | |
133 | |
110 | |
68 | |
55 |