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

Announcements
Only at Qlik Connect! Guest keynote Jesse Cole shares his secrets for daring to be different. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
soniasweety
Master
Master

Expression Not working

Hi all,

I created the variables

LastWeek =Week(today())-1     result:35

his week=week(today())     result:36

but when I use the below expression sometime its working some time its not working?    what is the issue?

below separate expresions tried  both giving some time correct sometime wrong.

=Count({<Flag={'1'},WeekNumber={'=$(ThisWeek)'}>}distinct Id)

=count({$<Week={$(=LastWeek)}>}distinct Number)

=Count({$<Flag={'0'},WeekNumber={$(=LastWeek)}>}distinct No)

1 Solution

Accepted Solutions
sam_grounds
Contributor III
Contributor III

Is this not to do with having two sets of '=' symbols? One in your expression and one in the variable.

Try setting This week to

     week(today())

and LastWeek to

     (Week(today())-1)

=Count(DISTINCT {$<Flag={1},WeekNumber={$(ThisWeek)}>} Id)

=Count(DISTINCT {$<Week={$(LastWeek)}>} Number)

=Count(DISTINCT {$<Flag={0},WeekNumber={$(LastWeek)}>} No)

View solution in original post

16 Replies
sunny_talwar

Can you explain when it does give correct result and when it doesn't?

Anil_Babu_Samineni

What does the Flag indicates over here?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
soniasweety
Master
Master
Author

expected output is

actually,  I don't have the data for 36 and 35th week  it should show zero  but it is not displaying anything if I put in text object

and the variables are working fine.  if I try in text objects.

sunny_talwar

Text box is not even showing 0? or is this in straight table or pivot table? If it is in a straight or pivot table, you might have to uncheck 'Suppress Zero Values' on the presentation tab of chart properties

Anil_Babu_Samineni

Does this same - As per calender week

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
soniasweety
Master
Master
Author

nothing showing in text object ,  its kpi object in qliksense

soniasweety
Master
Master
Author

yes anil,

flag is  I have two diff tables so I want to show the count of one table   I created flag for it because two tables concatenated

sunny_talwar

Can you show an image of what you see when the value for current week is 36 and value for previous week is 35?

Anil_Babu_Samineni

I agree, Then we might need more information related data and expect result set

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful