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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
curiousfellow
Specialist
Specialist

using variable set analysis

I have a qvd with a field that contains a timestamp in numeric notation (for example 43251,501435185)

When loading this qvd I find the highest value with : Set maxvalue=max(fieldname).

I use this variable in an expression like :

Sum( {<fieldname={"=$(maxvalue)"}>} counted_employees)

The result is the sum of all values and not only of the maxvalue.

When I use the expression :

     Sum( {<fieldname={'43251,501435185'}>} counted_employees) I get a correct result.


When I use the expression : Sum( {<fieldname={$(maxvalue)}>} counted_employees) i get an error

    Error: Error in set modifier ad hoc element list:

',' or ')' expected



The value 43251,501435185 was found with the expression =$(maxvalue) in a textbox


I don't no what is wrong with  my set analysis expression


Labels (1)
4 Replies
marcus_sommer
MVP
MVP

Your first attempt didn't work because your variable returned a value which is not 0 and therefore it is automatically TRUE and this for all records. By your second trial the return-value contained a comma which is here not treated as a decimal-delimiter else as a parameter-delimiter within the set analysis. But the following should be working:

Sum( {<fieldname={'$(maxvalue)'}>} counted_employees)

because the single-quotes convert it into a string-value like in your manually approach from above.

- Marcus

curiousfellow
Specialist
Specialist
Author

When I use single_quotes the result = 0

My settings are :

SET ThousandSep='.';

SET DecimalSep=',';

SET MoneyThousandSep='.';

SET MoneyDecimalSep=',';

sunny_talwar
MVP
MVP

Can you try this

Sum({<fieldname={"$(=$(maxvalue))"}>} counted_employees)

marcus_sommer
MVP
MVP

Then try: Sum( {<fieldname={'$(=maxvalue)'}>} counted_employees)