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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
abTech
Contributor III
Contributor III

Variable

How to count a specific value using a variable:

to count the flight if arrival_date is less that depart date

i used this expression  count({<arrival_date < departure_date }> flights)

 

Labels (3)
3 Replies
HirisH_V7
Master
Master

Count({$< arrival_date = {"<$(=depart date)"}>} Flights)
HirisH
marcus_sommer

In many scenarios it would be beneficial to do the essential work within the data-model - with something like:

Date1 - Date2 as DateOffset
class(Date1 - Date2, 3) as DateOffsetCluster,
sign(Date1 - Date2) as DateOffsetDirection

which could be used as dimensions and/or selections and/or conditions.

TauseefKhan
Creator III
Creator III

Hi @abTech,

LOAD *,
If(arrival_date < departure_date, 1, 0) as FlightFlag
FROM [YourDataSource];

And then use this flag in your expression:

count({<FlightFlag={1}>} flights)