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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
ravalib
Advocate II
Advocate II

HASONEFILTER or ISFILTERED not working for Timeline Slicer and Map

Hi guys,

 

I am trying to use hasonefilter/isfiltered on a timeline slicer which is on year level. What I want to do is, unless I make a year selection on the timeline slicer,  I want a particular bar graph to be empty. So I use a measure - if(hasonefilter(table[column_name],1,2) and set the measure to 1 under visual level filters. But this seems to work for everything else except the timeline slicer and the Map. Please let me know how i can get it to work for these two. 

 

Note: the column in the hasonefilter is date column which has date in the format mm-dd-yyyy. I believe this is the cause of the issue. Any help?

7 REPLIES 7
v-shex-msft
Community Support
Community Support

Hi @ravalib,

 

I'd like to suggest you to use HASONEVALUE function to instead:

 

flag = IF(HASONEVALUE(Silcer[Type]),1,2) 

8.PNG9.PNG

 

 

>>Also, if I multi-select the slicer after adding the above DAX, it is not working.

Since hasonevalue not works on multi-select, I modify the formula to use other condition to check if the slicer has been selected.

 

flag =
IF ( COUNTROWS ( Slicer ) <> COUNTROWS ( ALL ( Slicer ) ), 1, 2 )

10.PNG

 

Notice: since power bi can't correct recognize 'all select' and 'unselect', it not works when you select all items on slicer.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

 Thanks a lot for your reply.

 

I also asked about how if we have multiple slicers (more than 1), how will we make sure that the visual goes blank unless a selection is made in any of these slicers? I basically want the same thing to happen.. except with more than 1 slicer.. can u please suggest?

 

HI @ravalib,

 

>>I also asked about how if we have multiple slicers (more than 1), how will we make sure that the visual goes blank unless a selection is made in any of these slicers? I basically want the same thing to happen.. except with more than 1 slicer.

For your requirement, you can duplicate bold part formula with needed slicer source table as conditions.(use 'AND' logic link them)

flag =
IF ( COUNTROWS ( Slicer ) <> COUNTROWS ( ALL ( Slicer ) ), 1, 2 )

Sample:

flag =
IF (
    COUNTROWS ( Table1 ) <> COUNTROWS ( ALL ( Table1 ) )
        && COUNTROWS ( Table2 ) <> COUNTROWS ( ALL ( Table2 ) ),
    1,
    2
)

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Thanks. I edited the question just to be more specific. Please look at that and let me know.

HI @ravalib,

 

Can you please share the pbix file for test?

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Sorry, it is confidential data and it is coming from a DB. Not allowed to do so.

hi @ravalib,

 

Did you find any solution for this issue.

 

Thanks

Pallavi

Helpful resources

Announcements
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!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.