Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
pascos88
Creator II
Creator II

set analysis doesn't work well

Hi all,

I have some problems with this set analysis:

max({$<CampaignYear={"$(=Max(CampaignYear)-1)"}>}Score)

I attached the file output, I don't get why I cannot see the data from  the previews year..

Thanks for any helps

1 Solution

Accepted Solutions
colinh
Partner - Creator II
Partner - Creator II

Your set analysis is basically saying "show the max score where Year = 2017".

To achieve what you want you need to use the above() function.  This blog post should help:  The Above Function

View solution in original post

10 Replies
colinh
Partner - Creator II
Partner - Creator II

Your set analysis is basically saying "show the max score where Year = 2017".

To achieve what you want you need to use the above() function.  This blog post should help:  The Above Function

YoussefBelloum
Champion
Champion

Hi

I think it is working well because your max year = 2018.. so max year -1 = 2017 and data is populated for 2017

Chanty4u
MVP
MVP

Hi.

try this

Sum({$<CampaignYear={"$(=Max(CampaignYear)-1)"}>}Score)

pascos88
Creator II
Creator II
Author

Thanks for your answer..

So I would populate that for all rows...

How I should write it?

any idea?

pascos88
Creator II
Creator II
Author

it doesn't work, I achieve the some results..just populate for 2017

thi_pham
Creator III
Creator III

The max(CampaignYear) always return 2018, then it just populate for 2017.

I think you should check Above() function as colinh mentioned above.

  Above(max(score))

pascos88
Creator II
Creator II
Author

Hi I don't think that Above could be a solution, because the table that you can see in the picture, is a filtered table.

I needed maybe just to change the set expression and not populate the max score for just 2017 (max Year -1), but for all of them.

colinh
Partner - Creator II
Partner - Creator II

That would just give you the same as max(Score).  If you want to show the value from a different row, e.g., the 2017 value on the 2018 row, then you'll need to use an inter-record function such as above().  Alternatively you could do it in your load script using peek() or previous(), or by creating a table with Year-1 as a dimension and then joining that to your original table.

thi_pham
Creator III
Creator III

I agree with you. An easiest way is to add a new dummy calculation column in data load namely Previous_Campaigned_Year= Campaigned_Year - 1

then make the set analysis like:

    max( {<CampaignYear= P(Previous_Campaigned_Year) >}  Score)