Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Everybody,
my script is like below
sale:
LOAD Name,
Prd.Cat.No,
Sales,
'bill' as Category
FROM
(ooxml, embedded labels, table is Sheet1) where Prd.Cat.No =101;
Concatenate
LOAD Name,
Prd.Cat.No,
Sales,
'book' as Category
FROM
(ooxml, embedded labels, table is Sheet1) where Prd.Cat.No =102;
so i want to create one another table which is category type as "book / bill"
which is like
LOAD Name,
Prd.Cat.No,
Sales,
'book / bill' as Category
FROM
(ooxml, embedded labels, table is Sheet1) ;
How it is possible in script ?????????
Thanks in Advance.
Can you try this?
Sample:
LOAD * INLINE [
Name, Prd.No, Sales
abc, 101, 120
xyz, 101, 180
pqr, 101, 270
abc, 102, 30
xyz, 102, 60
pqr, 102, 90
];
Final:
NoConcatenate
load Prd.No, Sum(Sales) as Sales, 'Bill' as Category
Resident Sample Where Prd.No = 101 Group By Prd.No;
load Prd.No, Sum(Sales) as Sales, 'Book' as Category
Resident Sample Where Prd.No = 102 Group By Prd.No;
DROP Table Sample;
Last:
NoConcatenate
LOAD Sales, Prd.No, Category Resident Final;
Concatenate
LOAD Prd.No, 'Bill/Book' as Category, If(Prd.No = 101,Sum(Sales))/If(Prd.No = 102,Sum(Sales)) as Sales Resident Final Where Prd.No = 101 and Prd.No = 102 Group By Prd.No;
DROP Table Final;
You can create flag using if condition also. Try below
Sample:
LOAD Name,Prd.No,Sales,if(Prd.No=101,'Bill','Book') as Flag,if(Prd.No=101,Sales) as BillSales,if(Prd.No=102,Sales) as BookSales INLINE [
Name, Prd.No, Sales
abc, 101, 120
xyz, 101, 180
pqr, 101, 270
abc, 102, 30
xyz, 102, 60
pqr, 102, 90
];
concatenate
Load 'Bill/Book' as Flag,Sum(BillSales)/Sum(BookSales) as sales_div Resident Sample;
Regards,
Are you sure, this will return 'Bill/Book' ?? I wonder, This may returns null()
Yes..
for bill/book it's giving value as Zero
PFA.
Regards,
In your earlier reply you are taking category as dimension. So logic is as per category field.
Replace Name field with Flag You will get desired result.
See below snap shot for your reference.
If it is not solving your requirement , mention what is your actual and complete requirement.
Regards,