Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
ha142000
Contributor II
Contributor II

doubt in query

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:

ha142000_0-1657779255803.png

 

Can anyone explain this  what is that sales here  Date(MonthStart(CalDate), 'MM-YYYY') as MonthYear,
1000*Rand() as Sales;

Labels (2)
1 Reply
MayilVahanan

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...

 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.