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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Amit_B
Creator III
Creator III

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)
5 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
MVP
MVP

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.

Chanty4u
MVP
MVP

Try this 

=Only({<

      DateType = {'PaymentDate'},

      CalendarDate = p(PaymentDate)

   >} PaymentDate)

Amit_B
Creator III
Creator III
Author

Thank for the reply.

I t doesn't work for me.
I tried to define it as a dimension and as measure.