Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
pnn44794
Partner - Specialist
Partner - Specialist

Strange Calculation Results

Hello:

I'm getting some inconsistent calculation results from my Load script.  The following is a snippet of code from the load script:

Num(If(IsNull([Business Days End 2 END ( without Approvals )]), [Business Days End 2 END ( with Approvals )], [Business Days End 2 END ( without Approvals )]), '#0') as [Actual GTI Days],

LastWorkDate(RangeMax([Order Create Date], [Approval Complete Date]), [E2E SLO] + 1) as [SLA Breach Date],

Num(If([Order Complete Date] > LastWorkDate(RangeMax([Order Create Date], [Approval Complete Date]), [E2E SLO] + 1), 1, 0), '#0') as Breach

Sometimes, Breach will be zero or 1 as expected and then for other rows, it is not.  I've attached sample data.  If you look at, for example, rows 9 - 15, I would expect the values to be all zero's for Breach.  In my pivot table chart, I then have an expression column where the calculation is Sum(Breach)/Count([Host Name]).  As you're probably guessing, the calculation is not correct in the chart.  The idea is to calculate the percent delay from the SLA.  As an FYI, while Host Name is a text field, it is used for counting the number of orders, 1 Host Name = 1 Order.

I've also attached export of the pivot table for reference.  I'm thinking, for example, that the % Delay From SLA for VSI in the OS Build section should be somewhere around 20% maybe.  Would I perhaps need to format some of the date columns being used a certain way?  Here are the one's that would be in play and which in the Load script:

Date([Order Complete Date], 'MM/DD/YYYY') as [Order Complete Date]

Date([Order Create Date], 'MM/DD/YYYY') as [Order Create Date],
Date([Approval Complete Date], 'MM/DD/YYYY') as [Approval Complete Date]

As always, thanks in advance for any and all replies.  All help is appreciated.

48 Replies
sunny_talwar

I think you might have accidentally added the old sample file.

pnn44794
Partner - Specialist
Partner - Specialist
Author

LOL.  You are right.  I did.  Try this one.

sunny_talwar

The Breach stayed 0 for me using the same exact script that you sent me in the work document

Capture.PNG

pnn44794
Partner - Specialist
Partner - Specialist
Author

Very weird.  I wonder if my Qlikview desktop session is somehow corrupted.  I'm going to shutdown and reboot and then try a reload and see what happens.

sunny_talwar

Try that and also check the environmental variables to see if there is any differernce

SET ThousandSep=',';

SET DecimalSep='.';

SET MoneyThousandSep=',';

SET MoneyDecimalSep='.';

SET MoneyFormat='$#,##0.00;($#,##0.00)';

SET TimeFormat='h:mm:ss TT';

SET DateFormat='M/D/YYYY';

SET TimestampFormat='M/D/YYYY h:mm:ss[.fff] TT';

SET FirstWeekDay=6;

SET BrokenWeeks=1;

SET ReferenceDay=0;

SET FirstMonthOfYear=1;

SET CollationLocale='en-US';

SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';

SET LongMonthNames='January;February;March;April;May;June;July;August;September;October;November;December';

SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';

SET LongDayNames='Monday;Tuesday;Wednesday;Thursday;Friday;Saturday;Sunday';

pnn44794
Partner - Specialist
Partner - Specialist
Author

Ok.  I rebooted and added any environment variables you have that I don't.  I then did a reload.  I get the same wrong results.  I then, for kicks, deleted my code and pasted in the code from your sample qvw.  I still get the wrong results.  Things are showing up as breached when they shouldn't be.

Yet, in your sample qvw, it's correct.  Very weird.

pnn44794
Partner - Specialist
Partner - Specialist
Author

What's really weird is that it's not consistent or does not appear to be consistent when it gets it wrong.  A lot of them are correct.

sunny_talwar

Can you post an image of equivalent of what I have selected from your app?

pnn44794
Partner - Specialist
Partner - Specialist
Author

Will do.

pnn44794
Partner - Specialist
Partner - Specialist
Author

I hope this works.