Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Giansonn
Creator
Creator

How to store a number from one set expression to use in a different set expression?

I am currently building a chart that excludes some dates as follows:

count({$<stock_date={"<=$(=date(($(=varMaxDate)-week_number),'DD/MM/YYYY'))"}>} scan_id)
/ count({<stock_date={"<=$(=date(($(=varMaxDate)-week_number),'DD/MM/YYYY'))"}>} total <Category> scan_id)

The equation results as a percentage, and it is on a chart where week_number is on the x-axis. However this expression doesn't work since when we use total the week_number could be any one. Is there a way to take week number from the first expression and use it in the total expression?

Labels (2)
5 Replies
Wlad_Masi
Employee
Employee

Hi @Giansonn ,

 

Would this be something you could calculate in the script and save into a variable?

To help users find verified answers, please don't forget to mark a correct resolution or answer to your problem or question as correct.
Kushal_Chawda

Replace total <Category>  with total <WeekNumber>  

Giansonn
Creator
Creator
Author

@Wlad_Masi unfortunately no I dont think that there is a way, especially with trying to retain filtering.

 

@Kushal_Chawda Unfortunately that would not work because I want all the data but I want to use a restriction based on the current x-axis value. Unfortunately when you use total you can no longer refer to the categorical variable in an expression since it uses all of the categories.

Kushal_Chawda

so try including weeknumber as well in total  like total <Category,WeekNumer> or try below expression

sum(total <WeekNumber>aggr(count({<stock_date={"<=$(=date(($(=varMaxDate)-week_number),'DD/MM/YYYY'))"}>} scan_id),Category,WeekNumber))

Giansonn
Creator
Creator
Author

Super kudos for trying but I don't think now that this is possible.

 

The chart has been deleted now but I have a copy of it stored so if a solution ever does become available I will let you guys know.

 

Thanks for all your help.