Announcements
cancel
Showing results for
Did you mean:
Creator

Is current date in the selected range?

Hi,

I need to create a measure that uses a condition based on checking if the current date is part of the selected range. The selection does not have to be on the Date field, but also with other field (Year, Month, Quarter, YTD, MTD).

For example:

Date=03/10/24-03/14/24 --> Current Date is in the selected range.

Year=2024 --> Current Date is in the selected range.

Year=2024, Month=2 --> Current Date is not in the selected range.

Clear all selection --> Current Date is in the selected range (no selection was made so all dates are in the range).

Hope I was clear.

Thanks.

Labels (2)

• expression

1 Solution

Accepted Solutions
Creator
Author

Solution:

If(Max(Date) = Max({1} Date), ...)

5 Replies

Isn't that automatic in Qlik?

-Rob

Creator
Author

I need to write a condition that will perform a calculation based on the user's selections. If the current date is part of the selected range then measure X will be calculated, otherwise measure Y will be calculated. Both measures will perform the calculation correctly for the selected dates range, the question is which index will be displayed.

I think something along the lines of

if(Date = Only({\$} Date), Sum({1} Sales), Sum({1} Margin)

In the mesures (Sum used as example here) you may want to use something other than {1}, perhaps instead using modifiers to ignore the date selection(s) -- depends on your requirement.

Creator
Author

Sorry but I didn't understand how to set the condition. I also checked this Only function, but I couldn't find a solution.

I created a KPI that will display 1 if the current date is in the selected range, or 0 if not. I selecting only Year value, so if I select 2024 than I recieve 1, else 0.

Creator
Author

Solution:

If(Max(Date) = Max({1} Date), ...)