Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Linear Table

Hi everyone,

I'm new on QLIK so I have some problem.

I've a question for you.

I did a Linear Table with 3 fields (Name,Surname,Score). I've 30 results (lines or record).

I'd like to Sum only the first 5 score and put it in a new column called "Best 5 scores".

How can I do an expression that sum only the first 5 records ??

Thank you so much

JP

27 Replies
vgutkovsky
Master II
Master II

It's too complicated to do in the UI so I had to take the logic to the script. See attached.

Regards,

Vlad

Not applicable
Author

Hi Vlad,

thank you so much.

It works perfectly.

I'm glad to know it's possible to solve my problem only using the logic script because I was thinking i didn't understand at all the rank function

Again, thank you so much for your kindless.

Best regards,

Giampiero

Not applicable
Author

I was thinking a solution using variables in the UI.

I have a question for you Vlad.

I can use global variables in the UI ? If I well undesrtood variables in QLIK are only locals.

For instance, If I use a variable VScore in my table, and I build an expression like this: VScore = Score, it changes valure for each rows of my table and I can use it in a global way (for instance in an other table).

I hope I was clear

regards,

Giampiero

vgutkovsky
Master II
Master II

I don't think that will work, or at least I don't see any way you can do this with variables or the rank function. The problem with RANK is that it only allows qualifier "total" across all dimensions, so for example, "rank(total <FullName> Score)" won't work.

If you want to play around with variables, you can, though. If you precede a variable definition with a "=" then it will be evaluated once per application. If there is no "=" then you can use it to store expressions. So, for example, variable:

=max(Score) will return the maximum total score across all values

max(Score) can be used with variable expansion to replace an expression that will respect chart dimensions.

Regards,

Vlad

Not applicable
Author

I see.

Well i was trying to improve my knowledge on Qlik

I think that lots of problems I will face on Qlik I have to solve it using a mix between logic script and UI.

I learned a lot about Qlik thanks to you Vlad.

Thanks a lot

Regards,

Giampiero

Not applicable
Author

Hi,

I'm a bit obstinate and I keep trying some experiment with variables.

I created a variable Vtest, then in my table I created two expressions:

1) If(Score='821.78',vTest=10,vTest=20)

2) if(Score='818.78',vTest = vTest * 10,vTest = vTest * 20)

In this way I'd wanted to assigne in vTest variable the values 10 or 20 and then modify vTest in 100 or 200 ... but it doesn't work.

What I'm trying to do is to use variables in the UI to make some calculation.

Regards,

Giampiero

vgutkovsky
Master II
Master II

Giampiero,

You can't assign a variable value from a chart, you can only read it in. I'm not exactly sure why you need variables in your application at all...

Regards,

Vlad

Not applicable
Author

Hi Vlad,

I was just trying to use variables in a different way

After my attempt, I understood it's not possible to assign a value to a variable in my chart.

You confirm to me it's not possible.

Thank you so much

Best regards,

Giampiero