Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Learn how to migrate to Qlik Cloud Analytics™: On-Demand Briefing!
cancel
Showing results for 
Search instead for 
Did you mean: 
Amit_B
Creator II
Creator II

DateType variable in detail table

Hi,

I have an orders table with 3 date fields - OrderDate, SupplyDate, PaymentDate. This table is linked to a single calendar table through a bridge table (for different date types).
The users selected which date type they wanted to see the data by. Until now, a 'date type' filter was used and everything worked fine.
It was necessary to remove the filter, and now I using a variable (that received the selected date type), buttons that updates the value of the variable, and I placed it inside a set analysis.

The issue is with the details table, where all the order information is displayed, including the 3 dates. I am unable to implement the use of the variable successfully.

It does work for me when the user selects a continuous period (January-March 2025 for example). In this case, I use variables that store the min selected date and the max selected date.
For example, for OrderDate the dimension formula is:
If(vDateSelected = 'OrderDate',
    If(OrderDate >= vMinSelectedDate and OrderDate <= vMaxSelectedDate, OrderDate, null()),

    OrderDate
)

If a non-continuous is selected (for example January 2024 and January 2025), this method will not work because it will include all the dates in the range that weren't selected (February-December 2024).
I need a way to apply this only to the dates within the selected range(s).
 
I hope I was clear enough.
I would appreciate some help in finding a solution.
Labels (4)
3 Replies
Vegar
MVP
MVP

You could try to explore the possibilities of using set analysis with impicit field value modifiers.

I don't know the details of your datamodel nor variables, but you could try something in the style like this:

If(vDateSelected = 'OrderDate', only({<OrderDate=P(Date)>}OrderDate))

Nagaraju_KCS
Specialist III
Specialist III

May be this 

If the user has selected a date, only display the corresponding date field if that date exists within the selected calendar dates.

=If(vDateSelected = 'OrderDate',
 If(WildMatch(OrderDate, P(CalendarDate)),OrderDate,Null()),
 OrderDate)

marcus_sommer

If the user selects the periods - you won't need any queries to them to define dimension/expression conditions else the native Qlik usability will do the job.

Beside this I suggest to rethink the data-model because within the most scenarios it doesn't need a bridge-table else a single date-field in the facts + source-information (order, supply, payment) is enough to differentiate between them and each record could - with a few simple mappings - within a flag-field know which other parts already exists.