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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

Top Solution Authors