Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

If else then statement on a date slicer

Hi Guys,

 

I have a date slicer and my client would like to have a table that shows the CONTRACTID, SIGNATUREDATE AND EXPERATIONDATE.

 

iIam not able to create a date slicer and to show if a user click on the date of today from date slicer, the signaturedate must be +1 and experationdate must be -1. Please check the underneath image for example.

 

Any suggestions? Many thanks.

 

 

  • You just need a function to calculate it based on your date. My date field is called sql_date just replace your date.

     

    Selector = if(Query1[sql_date]=date(year(now()),month(now()),day(now())),"Today",if(Query1[sql_date]=date(year(today()-1),month(today()-1),day(today()-1)),"Yesterday","Other"))

11 Replies

  • gooranga1's avatar
    gooranga1
    Icon for Power Participant rankPower Participant

    I would unpivot my underlying data table and create a new table with columns

     

    Contract ID          DateType             Date

    1                          SignatureDate     10/1/2018

    1                          ExpirationDate     31/12/2018

     

    Then you could add a calculated date column that added 1 day to type SignatureDate and -1 to ExpirationDate you could then use this new calculated column to filter.

     

    You could use a matrix table to display the data grouped by contractid with date types across the top.

    • Anonymous's avatar
      Anonymous
      Not applicable

      gooranga1,

       

      Thanks for your idea.  how can i create a column DateType (the one that you mentioned)  that only return SignatureDate or ExpirationDate?

       

      • gooranga1's avatar
        gooranga1
        Icon for Power Participant rankPower Participant

        Screenshots below on how to unpivot and then add a date column based on +1 day for signature date and -1 day for expiration date.