Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a variable, vAvgHours, which returns an average hours of some data.
And I compare the value of the variable in a chart but the comparison result is not consistent.
In the screenshot below, Col1 is $(vAvgHours) and Col2 is $(vAvgHours)>= 1, but as the result is -1 for the first case and 0 for the second case, even though their values are the same.
Please let me know if I need to include more details in this ticket.
Thanks.
Hi, what expression is stored in vAvgHours? It could be better if you can upload a qvw with the sample to check what is behind that chart.
Thanks, Rubenmarin. It turned out that aggr calculations (it doesn't necessarily have to be a variable) are not working.
I attached a qvw file with data loaded. I included a table box with the original source and a table chart with the calculation that I need to figure out. Please let me know if you need more details.
HI
Might be, try like below
((SUM(AttMinutes)/60.0)/AVG(TargetHours)) >= 1
Hi, dividing 40 by 60 is, 0,6666... and by the limits of number lengh at the end Qlik puts a 7, so it's not exactly a third, and when converted to binary it can also lose some precission with decimals.
As suggested by @MayilVahanan it will be better to do the division outside the sum.
Also you can add a round to limit the decimals used in the comparison, like:
Round(SUM(AttMinutes)/60,0.01)/Round(AVG(TargetHours),0.01)>=1
Thank you for your reply, @rubenmarin.
That makes sense what happened in the real dashboard (the one I posted here is a sample because of the complexity) is it rounds up for the most of cases but only two lose the precision with decimals. If all lost the precision, it would be easier to find the root cause, but 16 cases out of 18 returned rounded number and two returned the result without some decimal points.
My problem is resolved but if you can find out the reason of the inconsistent output, that will be great.
Thanks!
Hi @kjun7603, in the sample all have the same data, if you can upload a sample with the data of those 2 cases I can take a look to see what's happening.