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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
AdrianoEllero
Contributor III
Contributor III

how to avoid to repeat filter within expression

I am using this expression that works:


Sum({<[Material Number (Product)]={
'xyz'
},
[CalendarYear]={"=CalendarYear"} //$(=Max(CalendarYear)-1)
>}Quantity)
-
//previous year
Sum({<[Material Number (Product)]={
'xyz'
},
CalendarYear={"$(=Max(CalendarYear)-1)"} //$(=Max(CalendarYear)-1)
>}Quantity)
)
/
//previous year
Sum({<[Material Number (Product)]={
'xyz'
},
CalendarYear={"$(=Max(CalendarYear)-1)"} //$(=Max(CalendarYear)-1)
>}Quantity)

But I would like to filter [Material Number (Product)]={'xyz'} just once, and not all the time I apply a formula.

Is there any way? 

something like:

if({<[Material Number (Product)]={'xyz'}>})...

???

Labels (5)
2 Solutions

Accepted Solutions
marcus_sommer

The newer releases are supporting the combination of inner and outer set statements. Therefore you may try something like:

{<[Material Number (Product)]={'xyz'}
   (sum(Quantity) - sum({< Year = {"$(=max(Year))"}>} Quantity)) /
    sum({< Year = {"$(=max(Year))"}>} Quantity)

View solution in original post

Rohan
Partner - Specialist
Partner - Specialist

Hi Adriano,

Which Version of Qlik Sense are you using ? In the newer versions ie versions after 2021 i think, this is possible.

{<Material={"xyz"}>}

(Sum({<YTD expression>} Sales) - Sum({<PYTD Expression>} Sales))/

Sum({<PYTD Expression>} Sales)

 

The set for Material will apply on all the 3 sum expressions. Check the following link for more details :

https://help.qlik.com/en-US/sense/February2024/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/SetAn...

 

 

Regards,

Rohan.

 

View solution in original post

3 Replies
marcus_sommer

The newer releases are supporting the combination of inner and outer set statements. Therefore you may try something like:

{<[Material Number (Product)]={'xyz'}
   (sum(Quantity) - sum({< Year = {"$(=max(Year))"}>} Quantity)) /
    sum({< Year = {"$(=max(Year))"}>} Quantity)

Rohan
Partner - Specialist
Partner - Specialist

Hi Adriano,

Which Version of Qlik Sense are you using ? In the newer versions ie versions after 2021 i think, this is possible.

{<Material={"xyz"}>}

(Sum({<YTD expression>} Sales) - Sum({<PYTD Expression>} Sales))/

Sum({<PYTD Expression>} Sales)

 

The set for Material will apply on all the 3 sum expressions. Check the following link for more details :

https://help.qlik.com/en-US/sense/February2024/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/SetAn...

 

 

Regards,

Rohan.

 

AdrianoEllero
Contributor III
Contributor III
Author

qlick server version 14.129.21 parth 14 - May 2023