Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
eikenberg
Contributor III
Contributor III

Set Analysis: Cant get condition working

Hello,

i cant get this set analysis working. The commented out one is working, but i want sums for max available year, max available year -1, etc

JAHR = year column
NETTOTOTAL = total column


/*
Sum(
{$<
JAHR={2024}
>}
NETTOTOTAL
)
*/

Sum(
{$<
JAHR={"=$(=(Max(JAHR)))"}
>}
NETTOTOTAL
)

 

The data is fetched from oracle

SELECT to_char(belegdatum, 'yyyy') AS Jahr,
...

 

Any hint how to slove this?

Thanks

Labels (1)
1 Solution

Accepted Solutions
mohamedafzal
Contributor III
Contributor III

Can you try the below:
Sum({$<JAHR={$(=Max(JAHR))}>}NETTOTOTAL)

View solution in original post

7 Replies
Or
MVP
MVP

Try changing Jahr to a numeric value as Max() works with numeric values. Alternatively, try using MaxString().

Clement15
Partner - Creator III
Partner - Creator III

Hello,
I think the = is too much.
Try this:
Sum(
{$<
JAHR={"$(=(Max(JAHR))"}
>}
NETTOTOTAL
)

mohamedafzal
Contributor III
Contributor III

Can you try the below:
Sum({$<JAHR={$(=Max(JAHR))}>}NETTOTOTAL)

ali_hijazi
Partner - Master II
Partner - Master II

if you put the max(JAHR) in a text object what does it return?

I can walk on water when it freezes
eikenberg
Contributor III
Contributor III
Author

This is working. Thanks.

But the syntax is hard to read and confusing. While in the commented out version i get the correct results for 2024 as number and string, the dynamic only works with MaxString.

Also a this is working

Sum({$<JAHR={"$(=MaxString(JAHR))"}>}NETTOTOTAL)

while an pair of extra brackets will not

Sum({$<JAHR={"$((=MaxString(JAHR)))"}>}NETTOTOTAL)

 

henrikalmen
Specialist
Specialist

You haven't said what the problem is/what unexpected result you are getting, but perhaps try this:

Sum({$<JAHR={$(=(Max({1}JAHR)))}>}NETTOTOTAL)

eikenberg
Contributor III
Contributor III
Author

I had gotten a total of 0 or a sum of all records. 

Your solution works too and reacts independent to already filtered data. Thanks.