Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Date | A | B | C | D = (A+B+C) |
01-07-2018 | 107.73 | 0.17 | 3.45 | 111.35 |
01-08-2018 | 106.02 | 0.00 | 3.45 | 109.47 |
01-10-2018 | 107.24 | 0.00 | 3.45 | 110.69 |
01-12-2018 | 105.13 | 0.00 | 3.45 | 108.58 |
01-01-2019 | 105.14 | 0.00 | 3.45 | 108.59 |
I need the output
Date | A | B | C | D = (A+B+C) |
01-07-2018 | 107.73 | 0.17 | 3.45 | 111.35 |
01-08-2018 | 106.02 | 0.00 | 3.45 | 109.47 |
01-09-2018 | 106.02 | 0.00 | 3.45 | 109.47 |
01-10-2018 | 107.24 | 0.00 | 3.45 | 110.69 |
01-11-2018 | 107.24 | 0.00 | 3.45 | 110.69 |
01-12-2018 | 105.13 | 0.00 | 3.45 | 108.58 |
01-01-2019 | 105.14 | 0.00 | 3.45 | 108.59 |
If the value is not available for any of the month then it should take the previous month max (Date) value for that particular month.
Please guide me to achieve this.
Table:
first 5
LOAD
"Date",
A,
"B",
C,
"D = (A+B+C)",
F
FROM [lib://DATA_SOURCES/cost logic.xlsx]
(ooxml, embedded labels, table is COST);
Temp:
Load
min("Date") as minDate,
max(Date) as maxDate
Resident Table;
Let varMinDate = Num(Peek('minDate', 0, 'Temp'));
Let varMaxDate = Num(Peek('maxDate', 0, 'Temp'));
DROP Table Temp;
TempCalendar:
LOAD
$(varMinDate) + Iterno()-1 As Num,
Date($(varMinDate) + IterNo() - 1) as TempDate
AutoGenerate 1 While $(varMinDate) + IterNo() -1 <= $(varMaxDate);
MasterCalendar:
Load
TempDate AS Date,
week(TempDate) As Week,
Year(TempDate) As Year,
Month(TempDate) As Month,
Day(TempDate) As Day,
date(monthstart(TempDate), 'MMM-YYYY') as MonthYear
Resident TempCalendar
Order By TempDate ASC;
Drop Table TempCalendar;
iN PRESENTATION:
Dimension : MonthYear
Measure: aggr(if(Sum([D = (A+B+C)])=0, above(Sum([D = (A+B+C)])),Sum([D = (A+B+C)])),MonthYear)