Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
LET vDMNoOfYear =20;
Let vMaxDate = Floor(YearEnd(Today()-1));
LET vMinDate = Floor(YearStart(AddYears(Today(), -($(vDMNoOfYear)))));
MasterCalendar:
LOAD
Year(CalDate) as Year,
WeekDay(CalDate) as WeekDay,
'Q' & Ceil(Month(CalDate)/3) as Quarter,
QuarterName(CalDate) as QuarterName,
Month(CalDate) as Month,
If(Month(CalDate) = Month(QuarterEnd(CalDate)), 1, 0) as MaxMonthFlag,
Date(MonthStart(CalDate), 'MM-YYYY') as MonthYear,
1000*Rand() as Sales;
LOAD
Date($(vMinDate) + IterNo()-1) as CalDate
AutoGenerate 1
While $(vMinDate) + IterNo()-1 <= $(vMaxDate);
LOAD QuarterName, Max(MonthYear) as MaxMonthYearPerQuarter Resident MasterCalendar Group by QuarterName;
For i=5 to 20 step 5
Load Distinct Year, 'Last '& $(i) & ' Years' as LastNYearFlag Resident MasterCalendar
Where Year > Year(Today())-$(i);
next
o/p:
Can anyone explain this what is that sales here Date(MonthStart(CalDate), 'MM-YYYY') as MonthYear,
1000*Rand() as Sales;
Hi
As informed in the another post, its sample data.
1000*Rand() as Sales <-- produce random sales values multiple by 1000 * (range between 0 to 1).
Ref:
https://help.qlik.com/en-US/qlikview/May2022/Subsystems/Client/Content/QV_QlikView/Scripting/MathCon...