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

Get 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

Reply
lravikiran
Helper I
Helper I

How to display contents of a table only when the slicer is selected .

Hi Experts,

 

           I have a situation where I need to hide the contents of table if my slicer is selected as "ALL" and show the data in table when a slicer is filtered to a perticular selection.

 

So In my example (Refere the Image ) Selected value issue.PNG, I have a table with country and sales. I have a country slicer on page. Only when my selection happens to a perticular country on the slicer should the data be displayed else it must be blank.

 

I tried creating a measure Filter = IF(HASONEFILTER(Orders[Country]),1,0) . 

 

 But it shows 0 only for total but when taking each rows into consideration it gives me issue.

 

PFA link to my pbix and image.

 

PBIX

1 ACCEPTED SOLUTION
d_gosbell
Super User
Super User

This is the expected behaviour for a measure with HASONEFILTER as the measure expression is effectively evaluated row by row and for every row except the grand total the Country field only has one filter.

 

One way of achieving your desired behaviour would be a measure like the following:

 

Filter = IF(COUNTROWS(ALLSELECTED(Orders[Country]))=1,1)

 

Or you could build this directly into a version of the Sales measure:

 

Filtered Sales = IF(COUNTROWS(ALLSELECTED(Orders[Country]))=1,[Sales])

View solution in original post

2 REPLIES 2
d_gosbell
Super User
Super User

This is the expected behaviour for a measure with HASONEFILTER as the measure expression is effectively evaluated row by row and for every row except the grand total the Country field only has one filter.

 

One way of achieving your desired behaviour would be a measure like the following:

 

Filter = IF(COUNTROWS(ALLSELECTED(Orders[Country]))=1,1)

 

Or you could build this directly into a version of the Sales measure:

 

Filtered Sales = IF(COUNTROWS(ALLSELECTED(Orders[Country]))=1,[Sales])

Thanks a lot . It is working .

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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