Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

I'm trying to round a value to 2 decimal places using a variable for the value without much success. What am I missing?

I've got a variable called  vAvgCallsPerHour which is a calculation stored as a variable so that if it changes, I only have to make one change which works fine

Calculation

3600/(Sum({<explanation={AMBWrapUp,ACDCallWrapup}>}duration)/sum({<explanation={ACDCallWrapup}>}Count)+Sum({<explanation={ACDAgentPicked}>}duration)/Sum({<Type={InboundCall}>}Count))

I then need to display this value in a text box  which I do by using '=$(vAvgCallsPerHour)' but this is displayed to approx 10 decimal places.


I've tried using =num($(vAvgCallsPerHour),'##.##') and the syntax checker seems happy enough but when I click ok I get ' Error: Error in expression: ')' expected


If I remove the dollar expansion i just get a -

What am I doing wrong?


Thanks

1 Solution

Accepted Solutions
Colin-Albert

Add the num() expression around the variable declaration.

Remember num() is just a formatting expression to truly round the value use round(xxx, 0.1), ceil(xxx, 0.1) or floor(xxx, 0.1)

Let vAvgCallsPerHour = num(3600/(Sum({<exp...InboundCall}>}Count)), '##.##') ;

View solution in original post

4 Replies
Colin-Albert

Add the num() expression around the variable declaration.

Remember num() is just a formatting expression to truly round the value use round(xxx, 0.1), ceil(xxx, 0.1) or floor(xxx, 0.1)

Let vAvgCallsPerHour = num(3600/(Sum({<exp...InboundCall}>}Count)), '##.##') ;

puttemans
Specialist
Specialist

Hi Gavin,

Best would be to use Round.

Round(3600/(Sum({<explanation={AMBWrapUp,ACDCallWrapup}>}duration)/sum({<explanation={ACDCallWrapup}>}Count)+Sum({<explanation={ACDAgentPicked}>}duration)/Sum({<Type={InboundCall}>}Count)),0.01)

Not applicable
Author

use:

Round( (3600/(Sum({<explanation={AMBWrapUp,ACDCallWrapup}>}duration)/sum({<explanation={ACDCallWrapup}>}Count)+Sum({<explanation={ACDAgentPicked}>}duration)/Sum({<Type={InboundCall}>}Count))), 0.10)

Not applicable
Author

You're a genius! Worked a treat.. Thank you