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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
jisephcirspy
Contributor III
Contributor III

How to calculate with numbers in column?

So, basically I've got a column that looks like this and I want to calculate the average of the column

Anmerkung 2020-08-10 160700.png

My draft is this, but it isn't working:

avg({<@time=-{'null'}>} num#(@time'#.##'))

Can you help me?

Labels (3)
1 Solution

Accepted Solutions
martinpohl
Partner - Master
Partner - Master

depending on your system

try

num(num#(@time,'#.##'))

or in my case 

replace(@time,'.', ',') 

is working because I have , as decimal seperator

Regards

View solution in original post

4 Replies
martinpohl
Partner - Master
Partner - Master

in a set analysis expression you can't work with number settings like num#()

as you can see, the field is left aligned, so the values are text, no numbers.

Edit in script to numbers then you can work with avg

Regards

fosuzuki
Partner - Specialist III
Partner - Specialist III

Hello,

Try this:

=avg({<[@time]=-{'null'}>} num#([@time], '#.##'))

 

EDIT: I'd recommend you to treat the data previously in the script so that it is ready to use on the front-end. If the data volume is big, the above expression may result in performance issues.

jisephcirspy
Contributor III
Contributor III
Author

Thank you for your answer @martinpohl !

How and where can I edit in my script to numbers?

martinpohl
Partner - Master
Partner - Master

depending on your system

try

num(num#(@time,'#.##'))

or in my case 

replace(@time,'.', ',') 

is working because I have , as decimal seperator

Regards