Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hi i have the following If statement and would like to further develop it to include only the previous months total.
Sum(Aggr(If((inLeveransDatum - Lev_Leveranstid)> Villkor_inlev, 1, 0), [%InLevNr]))
the Month field is called InLeveransDatumMonth
any help is greatly appreciated.
Best
Brad
Hi,
You can try something like below.
SUM(
AGGR(
IF(InLeveransDatumMonth = $(PreviousMonth) and
(inLeveransDatum - Lev_Leveranstid)> Villkor_inlev, 1, 0)
, [%InLevNr])
)
To get the previous Month variable have the previous month.
Have a month number field created in your dataset if its not existing already. For efficient result i suggest you have the month number field like... 201301, 201302, 201303....
Considering you have the month number field like above.
Table1:
Load Distinct Max(MonthNumber,2) as MonthNumber Resident Calendar;
LET PreviousMonth = Peek('MonthNumber', 0, 'Table1');
DROP Table Table1;
And in your IF condition also use the month field which is numeric.
hope this helps.
Regards,
Aadil