Hi All,
I have a fact table for Sale_Amt with date wise details. It is designed with self-join.
One of my reporting requirement is to show yesterday (sysdate-1), MTD (1st Nov to till date) and YTD sales (1st Apr 2018 to till date -- a Financial year)
Fact table data:-
Date item1 Sales item2 sales
01-Nov-2018 100 200
02-Nov-2018 200 300
03-Nov-2018 300 400
Report requirement:
Yesterday MTD (1st Nov to till date) YTD (1st Apr 2018 to till date)
Item1 300 600 10000
Item2 400 900 15000
I have applied below logics for Yesterday and MTD and it's working. But I am unable to find out the logic for YTD.
Yesterday:
FILTER("Sales"."Amount" USING ( "Date"."Date Time" = TIMESTAMPADD(SQL_TSI_DAY, -1, CURRENT_DATE)))
MTD:
FILTER("Sales"."Amount" USING ( "Date"."Date Time" between TIMESTAMPADD(SQL_TSI_DAY, -DAYOFMONTH(CURRENT_DATE) +1 , CURRENT_DATE) and TIMESTAMPADD(SQL_TSI_DAY, -1, CURRENT_DATE)))
Kindly suggest me the logic for YTD.
Thanks in advance
Best Regards,
Ram Reddy