Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
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
“Aspire to Inspire before we Expire!”
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)