Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All....
How can we calculate , Previous 12 months Totals in Script level (Not in UI level)..
Thanks
Madhu
You may create another Fact table which will have Summary data and join this table to your main fact table.
Let EndDate = MakeDate(2014,12,31);
Let StartDate = MakeDate(2014,1,31);
Item:
LOAD * INLINE [
ItemId, ItemName
1, Test Item 1
2, Test Item 2
];
Tmp:
LOAD * INLINE [
ItemId, Qty, Amount, SaleDate
1, 1, 1, 01/01/2014
1, 1, 1, 01/02/2014
1, 1, 1, 01/03/2014
1, 1, 1, 01/04/2014
1, 1, 1, 01/05/2014
1, 1, 1, 01/06/2014
1, 1, 1, 01/07/2014
1, 1, 1, 01/08/2014
1, 1, 1, 01/09/2014
1, 1, 1, 01/10/2014
1, 1, 1, 01/11/2014
1, 1, 1, 01/12/2014
2, 2, 2, 01/01/2014
2, 2, 2, 01/02/2014
2, 2, 2, 01/03/2014
2, 2, 2, 01/04/2014
2, 2, 2, 01/05/2014
2, 2, 2, 01/06/2014
2, 2, 2, 01/07/2014
2, 2, 2, 01/08/2014
2, 2, 2, 01/09/2014
2, 2, 2, 01/10/2014
2, 2, 2, 01/11/2014
2, 2, 2, 01/12/2014
];
TmpTotal:
Load ItemId, Sum(Amount) as TotalAmt
Resident Tmp
Where SaleDate >= '$(StartDate)' and SaleDate <= '$(EndDate)'
Group by ItemId;
Hope this Helps
Hi Shivendoo Kumar,
Can u please give me an example...
Thanks for ur reply.
Thanks
Madhu
Please go through this link. This will really help you
Hi,
Try like this
LOAD
*,
If(DateFieldName > AddMonths(Today(), -12), 1) AS Last12MonthFlag
FROM DataSource;
Now in front end use
Sum({<Last12MonthFlag={1}>} Sales)
Hope this helps you.
Regards,
Jagan.