Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

cancel
Showing results for 
Search instead for 
Did you mean: 
greend21
Creator III
Creator III

Calculations in the Load Script

I'm trying to do a calculation in the load script but I keep getting an invalid expression error. I thought it could be something with the dates being timestamps so I used floor to drop it and make it a number but that doesn't seem to be correctiong the issue either. Do you have any idea what the issue could be?

Sum(fabs(AllocAmt)*(Floor(ClosedDate)-Floor(TransEfftDate)))/Sum(Floor(ClosedDate)-Floor(TransEfftDate))

Thank you,

1 Solution

Accepted Solutions
vishsaggi
Champion III
Champion III

Can you share the script you are running and also a snapshot of your error msg? if you are using Sum() aggregate function are you using Group By in your script?

View solution in original post

3 Replies
vishsaggi
Champion III
Champion III

Can you share the script you are running and also a snapshot of your error msg? if you are using Sum() aggregate function are you using Group By in your script?

balabhaskarqlik

It'll throw invalid expression, cause data conversion not happened properly.

Create some variables like this and those.

Set vMaxInvoiceDay = Day($(vMaxInvoiceDate));

Set vDaysInMaxMonth = Day(MonthEnd(Month($(vMaxInvoiceDate))));

Set vRunRateFactor = ($(vDaysInMaxMonth) - $(vMaxInvoiceDay))/$(vMaxInvoiceDay);

greend21
Creator III
Creator III
Author

I completely forgot about the Group By. Since I am loading a lot of other fields I just did the calculations on a temp table and left joined them back. Thanks!