Skip to main content
Announcements
Qlik Community Office Hours - Bring your Ideation questions- May 15th, 11 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Tmassimo
Contributor II
Contributor II

set analysis syntax

Hi,

I use this set analysis to filter the data that belong to a week:

sum({$< tt_settimana ={"$(=vSettimana)"}>} tt_hh_inserite)

vSettimana is a variable so defined:

LET vSettimana = year(today()) & '-' & week(today()-7)

And is works correctly.

Now I need to filter the data >= vSettimana. I try some different syntax:

sum({$< tt_settimana ={"$(>=vSettimana)"}>} tt_hh_inserite)

sum({$< tt_settimana ={">=$(=vSettimana)"}>} tt_hh_inserite)

but these don't give me any result.

Can anyone help me, please?

1 Solution

Accepted Solutions
Tmassimo
Contributor II
Contributor II
Author

Thank you,

I removed '-'  and now the set analysis works correctly.

View solution in original post

5 Replies
lironbaram
Partner - Master III
Partner - Master III

hi 

this one should work 

sum({$< tt_settimana ={">=$(=$(vSettimana))"}>} tt_hh_inserite)

 

 

 

PrashantSangle

Some of the possible reason for not working is
1: result which you are getting for variable is in string. not in number because of '-' in it and you can not give range for text. so in that case convert it into number by removing '-' from both.

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 🙂
lfetensini
Partner - Creator II
Partner - Creator II


The expression cant be walk in up or down because its a "text" with '-' and not a number to be >=. Think about letter D, can E be >=D? Absolutely not.


Change your variable:

OLD (2019-30):
LET vSettimana = year(today()) & '-' & week(today()-7)

NEW (201930):
LET vSettimana = Year(Today()) & Week(Today()-7)


In Set, use:

Sum({<tt_settimana={">=$(=vSettimana)"}>} tt_hh_inserite)

 

You can ADD a Field in your calendar to walk (Week + 1) ou (Week - 1) between years if necessary. Try it:

AutoNumber(Num(Year(DATAFIELD)*54) + Num(Week(DATAFIELD))) as WeekID

Then use WeekID to do >= or <= and etc.

Support your colleagues. Remember to "like" the answers that are helpful to you and flag as "solved" the one that helped you solve. Cheers.
Tmassimo
Contributor II
Contributor II
Author

Thank you,

I removed '-'  and now the set analysis works correctly.

lfetensini
Partner - Creator II
Partner - Creator II

"Like" it the answers that are helpful to you and flag as solved the one that helped you solve.

Cheers.

Support your colleagues. Remember to "like" the answers that are helpful to you and flag as "solved" the one that helped you solve. Cheers.