Forum Discussion

ewoytowitz's avatar
ewoytowitz
Cloud Apps
06-02-2024
Solved

Help with filterFactory.dateRange

I have indicators with a date range filter set up on the Sisense website (see attached image). I am trying to replicate this set up in my UI with the sisense/sdk-data filterFactory.dateRange function, and I am struggling to know how I need to format the dates I pass in to get the same results as the Sisense website. I have tried passing in dates in a "YYYY-MM-DD" format, a "MM/DD/YYYY" format, and a date (new Date()) format. With all of these formats my indicators either return a 0 or N/A value, or values that are way too high (so it seems like the filter is not being applied). What do I need to do differently to get this working? I am trying to filter to show data from the last four weeks.

 

 
 <IndicatorChart {...widget.getChartProps()}
                filters={[filterFactory.dateRange(DM.SeasonCalendar.CalendarDate, fourWeeksAgoFormattedDate, todayFormattedDate)]} />
  • Hi ewoytowitz 

    Can you try adding .Days to your dimension to select a specific date level? e.g.

    DM.SeasonCalendar.CalendarDate.Days

    I think then it should work, if you use a date format like yyyy-MM-DD .. for example

     

    filters: [filterFactory.dateRange(Ecom.Commerce.Date.Days, '2013-04-01', '2013-04-28')]
     
    Hope that helps!
    Steve

2 Replies

  • steve's avatar
    steve
    Sisense Employee

    Hi ewoytowitz 

    Can you try adding .Days to your dimension to select a specific date level? e.g.

    DM.SeasonCalendar.CalendarDate.Days

    I think then it should work, if you use a date format like yyyy-MM-DD .. for example

     

    filters: [filterFactory.dateRange(Ecom.Commerce.Date.Days, '2013-04-01', '2013-04-28')]
     
    Hope that helps!
    Steve