Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Filter table date with Isfiltered

HI Team,

 

I have below table

 

DateCommentsCategory
1/1/2023HellloA
1/1/2023HiiiiiiA
2/1/2023Hello,testingB
3/1/2023hellllllA

 

If a slicer is filtered then show only rows where date is 16 days from today else show everything. 

How to achive this using a measure??

tamerj1  Fowmy  

  • Hi,

    1st create a separate slicer table using table functions. E.g.

     

    Then create a measure like this:

    FIlter if is filtered = IF(OR(ISFILTERED('Slicer table'[Comments]),ISFILTERED('Slicer table'[Category])),
    IF(COUNTROWS(FILTER('Table (21)', [Date]>=TODAY() && [Date]<=TODAY()+16))>0,1,0)
    ,1)

    Now place it into a visual like this:

     

    Then If you select a slicer from the slicer table the measure will work:

    To get the slicers to function with your table e.g. so that category slices category from your fact table repeat the logic like this:

    Category slicer = IF(
        ISFILTERED('Slicer table'[Category]),IF(
        MAX('Table (21)'[Category])=MAX('Slicer table'[Category]),1,0),1)

     

     

    Now the previously shown row is not shown since the row had category = A.

    I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

    My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/





1 Reply

  • ValtteriN's avatar
    ValtteriN
    Icon for Community Champion rankCommunity Champion

    Hi,

    1st create a separate slicer table using table functions. E.g.

     

    Then create a measure like this:

    FIlter if is filtered = IF(OR(ISFILTERED('Slicer table'[Comments]),ISFILTERED('Slicer table'[Category])),
    IF(COUNTROWS(FILTER('Table (21)', [Date]>=TODAY() && [Date]<=TODAY()+16))>0,1,0)
    ,1)

    Now place it into a visual like this:

     

    Then If you select a slicer from the slicer table the measure will work:

    To get the slicers to function with your table e.g. so that category slices category from your fact table repeat the logic like this:

    Category slicer = IF(
        ISFILTERED('Slicer table'[Category]),IF(
        MAX('Table (21)'[Category])=MAX('Slicer table'[Category]),1,0),1)

     

     

    Now the previously shown row is not shown since the row had category = A.

    I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

    My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/