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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
soniasweety
Master
Master

error in exp

Hi all,

currently my variable value is 

vCurrentWeekk=Week(today())

so in  expression I used    :  =Count({<WeekNumber={$(=vThisWeek)}>}id)     this will only only  this week data if I select other week in  filter it is not reflecting   so I tried below expression but its giving error

=if(GetSelectedCount()=0,week(today(),max(WeekNumber)))

1 Solution

Accepted Solutions
Kushal_Chawda

create variable on front end with below expression

=if(GetSelectedCount(Week)=0,week(today()),max(WeekNumber))

now try this expression

=Count({<WeekNumber={"$(=vThisWeek)"}>}id) 


or


=Count({<WeekNumber={"$(vThisWeek)"}>}id) 


Update: Error corrected in variable expression

View solution in original post

13 Replies
its_anandrjs
Champion III
Champion III

Try this

=Count({<WeekNumber={ "$(=Max(WeekNumber))" }>}id)


=if( GetSelectedCount()=0,week(today() ),max(WeekNumber))) // In this you forget ")"


Anil_Babu_Samineni

May be missed parenthesis

=if(GetSelectedCount()=0,week(today()),max(WeekNumber))

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

still error in expression

soniasweety
Master
Master
Author

still same error

its_anandrjs
Champion III
Champion III

Actually this is correct statement

=Count({<WeekNumber={ "$(=Max(WeekNumber))" }>}id)


Or


=IF( GetSelectedCount()=0, Week(Today()), Max(WeekNumber))

soniasweety
Master
Master
Author

still the error in expression

Anil_Babu_Samineni

May be this? Try and check

=Count({<WeekNumber={'$(=Week(Today()))'}>}id)

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
Kushal_Chawda

create variable on front end with below expression

=if(GetSelectedCount(Week)=0,week(today()),max(WeekNumber))

now try this expression

=Count({<WeekNumber={"$(=vThisWeek)"}>}id) 


or


=Count({<WeekNumber={"$(vThisWeek)"}>}id) 


Update: Error corrected in variable expression

its_anandrjs
Champion III
Champion III

Try this as well

=Count( {<WeekNumber={ "$(=Max(WeekNumber))" }>} id )


Or


=Count( {<WeekNumber={ '$(=Max(WeekNumber))' }>} id )

Or


=IF( GetSelectedCount()=0, Week(Today()), Max(WeekNumber))


Or


=IF( GetSelectedCount() = IsNull(), Week(Today()), Max(WeekNumber))