Oracle Analytics Cloud and Server

Welcome to the Oracle Analytics Community: Please complete your User Profile and upload your Profile Picture

OAC - Auto selection of Current Date in List Filter

Received Response
65
Views
9
Comments

Hii OAC Community. As shown below ,In some of our visualizations ,We have List Filter having Date values of Data type:Date and Format :dd/MM/yyyy .We want to make sure that the selection of Current Date is done automatically .For this we tried with Parameters ,but we couldn't found the current date value as shown below.Pls suggest if this the correct approach ? also how to resolve this .Thank you.

image.png image.png

Answers

  • Sushant Mishra
    Sushant Mishra Rank 5 - Community Champion

    You’re on the right track by using a date parameter to auto-select today’s date in your filter. For this to work, set your parameter’s initial value to an expression like CURRENT_DATE instead of a hardcoded date. Make sure your dataset always includes today’s date, otherwise the filter cannot select it automatically. If your data sometimes lacks the current date, consider applying a filter expression (YourDateColumn = CURRENT_DATE) or use the Relative Time Filter for best flexibility.

    Hope this helps.

  • RVohra
    RVohra Rank 6 - Analytics Lead

    Can you create a derived column in In your data model / dataset,

    Example:

    • CASE WHEN TRUNC("Your_Date_Column") = TRUNC(CURRENT_DATE) THEN 'Y' ELSE 'N' END AS Is_Today
    • Now add this column to your canvas.
    • Create a hidden filter Is_Today = 'Y' on to limit data to today’s date.
    • Leave the List Filter for date visible, users can still change it manually.
  • Jestin Rajan
    Jestin Rajan Rank 4 - Community Specialist

    Hi, to do this please set the data type to Timestamp and Auto, then set the initial value to the following Logical SQL:

    SELECT MAX(CURRENT_DATE) AS Current_Date FROM 
    
    XSA('<REPLACE_WITH_YOUR_DATASET_PATH>')
    

    You’ll just need to replace <REPLACE_WITH_YOUR_DATASET_PATH> with any existing dataset reference from your environment — that should do the trick.
    I’ve tested it on my end, and it works fine.

  • RVohra
    RVohra Rank 6 - Analytics Lead

    Excellent, thanks for sharing.

  • Hasan Sd
    Hasan Sd Rank 5 - Community Champion

    Thank you everyone for the responses, we'll test them one by one:

    Dear @Jestin Rajan ,we tried with the approach ,however we are getting an error as shown below, Can you pls advise what mistake we're doing ? Thank you.

    image.png
  • Jestin Rajan
    Jestin Rajan Rank 4 - Community Specialist

    Hi, most of it looks good. The only part I can’t verify is whether the reference is correctly set up as the LSQL expects. What I’d suggest is — since the file name shows as _kpi_dataset, please go to Data > (3 dots) > Inspect, and you should find an option to Copy Object ID. That exact ID is what needs to be copy-pasted here.

  • Hasan Sd
    Hasan Sd Rank 5 - Community Champion

    Thanks @Jestin Rajan ,After using object id ,it's auto selecting the current Date .However it's now in Timestamp Format .We require it in the format :dd/MM/yyyy .We tried changing the parameter Datatype from Timestamp to Date and Format :Custom - dd/MM/yyyy and keeping the same Logical SQL ,but its not working, Pls advise on this . Also find some screenshots below for your info:

    image.png

    image.png
  • Jestin Rajan
    Jestin Rajan Rank 4 - Community Specialist
    edited 4:55AM

    Glad it worked for you, @Hasan Sd ! What I’d suggest is to keep the parameter datatype as Timestamp (Auto), and then go to the visual and change the date format at the visual level from Auto to Custom (dd/MM/yyyy).

    image.png
  • Hasan Sd
    Hasan Sd Rank 5 - Community Champion

    Thanks @Jestin Rajan for the reply .However we are not using Dashboard Filter Type. We are directly using Filters inside Different Visualizations as shown below :In this we can't see any option to change Filter Format to dd/MM/yyyy .Pls advise what we should now do to resolve this :

    image.png

    image.png