Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

When all is selected or multiple values are selected in slicer, show nothing in line chart

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.

1 ACCEPTED SOLUTION

Yep, all good with HASONEFILTER 

View solution in original post

9 REPLIES 9

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()
)

 

 

 

 

Anonymous
Not applicable

@wynhopkins 

 

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.

jdbuchanan71
Super User
Super User

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.

Anonymous
Not applicable

@jdbuchanan71 

 

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 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.