Forum Discussion

AmiraBedh's avatar
AmiraBedh
Icon for Super User rankSuper User
4 years ago
Solved

Create From To filters based on MMM-YYYY with condition

I want to create the following filters :

I want when I select a date from To I want that the selection From is bigger than the first.

How can I achieve that ?

 

  • The simplest way is to create an error message when you select the To less than the From : 

     

    FromToValue = IF( SELECTEDVALUE('yourTable'[FromDate]) > SELECTEDVALUE('yourTable'[ToDate])

                                 ,"Invalid selection", "")

     

    If you want the hard way : 

    FromToValue = IF(CALCULATE('yourTable'[ToDate])>=SELECTEDVALUE('yourTable'[FromDate]) ),1,0)

     

    Set the visual slicer:

     

    since the measure could not be applied it in the slicer,you need to use the measure in visual.

1 Reply

  • amirabedhiafi's avatar
    amirabedhiafi
    Icon for Impactful Individual rankImpactful Individual

    The simplest way is to create an error message when you select the To less than the From : 

     

    FromToValue = IF( SELECTEDVALUE('yourTable'[FromDate]) > SELECTEDVALUE('yourTable'[ToDate])

                                 ,"Invalid selection", "")

     

    If you want the hard way : 

    FromToValue = IF(CALCULATE('yourTable'[ToDate])>=SELECTEDVALUE('yourTable'[FromDate]) ),1,0)

     

    Set the visual slicer:

     

    since the measure could not be applied it in the slicer,you need to use the measure in visual.