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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

expression and variable does not work

Hello,

I want to make a straight table, like in the image (see attachment).

The problem is, I have no data in the straight table. All labels give number zero.

Can someone help me? Is something wrong with the variable or expressions?

Thanks in advance.

First I have make a variable in the variable overview:

Name variable:

vSetPreviousNMonth

The variable definition is:

PeriodID = {$(=Max(PeriodID) – $1)},

Year = ,

Quarter = ,

Month = ,

Period =

Then I have make a straight table:  "Carrier Group" as the dimension.

And I have add the three expressions:

1. label: Current Month Flights,

expression:

Sum({$<$(vSetPreviousNMonth(0))>} [# Departures Performed])

2. label: Flights Previous Month

expression:

Sum({$<$(vSetPreviousNMonth(1))>} [# Departures Performed])

3. label: Flights Two Months Ago

expression:

Sum({$<$(vSetPreviousNMonth(2))>} [# Departures Performed])

4 Replies
PrashantSangle


Hi,

just check in Text Object that Your variable returning any value or not.

In text Object write

=vSetPreviousNMonth

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
awhitfield
Partner - Champion
Partner - Champion

Looks like you are using the Qlikview for Developer books, but I'm not sure what you actual issue is , as the screen shot looks to be correct when compare to my copy of the dashboard.

Andy

jyothish8807
Master II
Master II

Hi Michel,

First of all what is Period ID ? Is it is date format or in month format ?

Assuming it is in month format:

Create a variable:

let vMonth=month(max(PeriodID))

Now in your straight chart:

Expression1:

sum({PeriodID={'$(=vMonth)'}[#Depature Performed])

Expression2:

sum({PeriodID={'$(=vMonth-1)'}[#Depature Performed])

Expression3:

sum({PeriodID={'$(=vMonth-2)'}[#Depature Performed])

Hope it works

Regards

KC

Best Regards,
KC
pavendhan
Partner - Contributor III
Partner - Contributor III

Try this,

In the load script add one column

num(AutoNumberHash256(year(Datecolumn) & month(Datecolumn)),'00') AS HashYearMonth,

1. label: Current Month Flights,

expression:

=Sum({<HashYearMonth= {$(=max(HashYearMonth))}>}[# Departures Performed])

1. label: Previous Month Flights,

expression:

=Sum({<HashYearMonth= {$(=max(HashYearMonth)-1)}>}[# Departures Performed])

3. label: Flights Two Months Ago

expression:

=Sum({<HashYearMonth= {$(<max(HashYearMonth)-2)}>}[# Departures Performed])