Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I seem to be getting an error when creating calculations using a preceding load statement. Below is an example of my code:
Facts:
LOAD *,
Budget_Parts - Actual_Parts as Total
;
LOAD
CSC#,
CSC,
Parts as Budget_Parts,
Tires,
Tools
'Budget' as Source
FROM [Data\Budget.xlsx];
Concatenate(Facts)
LOAD
CSC#,
CSC,
Parts as Actual_Parts,
Tires,
Tools,
Physical_Damages,
' Supplies
'Actuals' as Source
'Budget' as Source
FROM [Data\Budget.xlsx];
I obtain a 'Field Not Found' error, where it cannot find 'Actual_Parts'.
What are the workarounds and solutions for this?
Many thanks all
Sabah
the first Load is reading from where?
did you put a from or resident?
Hey,
The first load i.e.
LOAD *,
Budget_Parts - Actual_Parts as Total
;
this is reading from the loaded Facts table which I am first loading
I have tried doing a RESIDENT load, but the value comes out as NULL
Hi,
You can't use same name for two fields in single table.
'Actuals' as Source,
'Budget' as Source
HTh
sushil
Various things are unconventional about this piece of code.
To fix the problem in your post title: remove the first (Preceding) LOAD and put this behind the two remaining LOADS:
Facts2:
NOCONCATENATE
LOAD *, Budget_Parts - Actual_Parts as Total
RESIDENT Facts;
But even while this may seem to work, it doesn't make sense because every Budget_Part field has an Actual_Parts field equal to NULL, and vice versa.
Rethink your logic.
Sushil,
even with the Source Field commented out, it still raises the following error:
Your posted script is different from the one in this error message. We are talking about different things here. How exactly do you want us to help you?
Hi,
Try this
Facts:
LOAD
CSC#,
CSC,
Parts as Budget_Parts,
Tires,
Tools
'Budget' as Source
FROM [Data\Budget.xlsx];
Concatenate(Facts)
LOAD
CSC#,
CSC,
Parts as Actual_Parts,
Tires,
Tools,
Physical_Damages,
' Supplies
'Actuals' as Source
'Budget' as Source
FROM [Data\Budget.xlsx];
Load *,
[Budget_Parts]-[Actual-Parts] as Total
resident Facts;
I agree with rakesh1108 that you should change the order and load the Actuals and Budgets and then combine them.
If this helped you, please mark as Helpful. If it solves your issue, please mark as Answer
Regards
Dhruv
Hi,
Try like this
Temp:
LOAD
CSC#,
CSC,
Parts as Budget_Parts,
Tires,
Tools,
'Budget' as Source
FROM [Data\Budget.xlsx];
Concatenate(Temp)
LOAD
CSC#,
CSC,
Parts as Actual_Parts,
Tires,
Tools,
Physical_Damages,
Supplies,
'Actuals' as Source
FROM [Data\Budget.xlsx];
Data:
LOAD *,
RangeSum(Budget_Parts, - Actual_Parts) as Total
Resident Temp;
DROP TABLE Temp;
OR
Temp:
LOAD
CSC#,
CSC,
Parts as Budget_Parts,
Tires,
Tools
FROM [Data\Budget.xlsx];
LEFT JOIN(Temp)
LOAD
CSC#,
CSC,
Parts as Actual_Parts,
Tires,
Tools,
Physical_Damages,
Supplies
FROM [Data\Budget.xlsx];
Data:
LOAD *,
Rangesum(Budget_Parts, - Actual_Parts) as Total
Resident Temp;
DROP TABLE Temp;
Hope this helps you.
Regards,
jagan.