Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Lisa2
Contributor
Contributor

Variable in Load Script

Hello, I am trying to make a variable in the load script but there are errors so I'm not sure if it is possible.  I would like to make a variable that is the sum of Items from a year range. 

Load:

Items,

Sum(Items where Year 2000 >= =< 2005 from excel file) as Range,

Location,

cost,

Year

From Excel File;

Labels (2)
3 Replies
Taoufiq_Zarra

you have to use a group by.
Can you share a sample data  to share the exact answer?

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
mousumimondal
Contributor II
Contributor II

Hi Lisa,

Please create a variable (say: vRentableArea) from Setting--> Variable Overview and set default value as 0.

Then write below the script to get the sum of field values and rename as name of the variable vRentableArea.

RentableArea:


LOAD
sum([Rentable Area (SqFt)]) As vRentableArea
FROM [..\Data\Report B.xls](biff, embedded labels) WHERE [Event Year Group] = '2020';

Let vRentableArea = Peek('vRentableArea',0,'vRentableArea');

 

Now load the script again and you can have the vRentableArea variable with expected value at front end.

Hope this will be a helpful solution.

 

Thanks

Mousumi

Brett_Bleess
Former Employee
Former Employee

Lisa, did the last posters suggestion work for you?  If so, do not forget to return to your thread here and use the Accept as Solution button on that post to give them credit for the help and let other Members know that it worked.  If you did something different, consider posting that and once posted, use the button to mark that to close out the thread.  If you are still needing something, please leave an update.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.