Create fields in the script for day, month, year and quarter:
Day(MyDate) as Day,
Month(MyDate) as Month,
'Q' & Ceil(Month(MyDate)/3) as Quarter,
Year(MyDate) as Year,
Then you can use the new Year, Quarter, Month and Day fields in a pivot table so you expand them. Or you can create a drill down group with those fields.
In addition to the great answers provided by our community members you may also be interested in this:
- Qlik Sense 3.0 - Preparing Data with Visual Data Preparation
- Qlik Sense 2.2 - Preparing Data - Part 2
- Understanding the Master Calendar (video)
In Qlik Sense 2.2 preparing data with the data manager also automatically created date/time dimensions - it generates them automatically by inserting the derive and define expressions section in the data load script. You can see this after you prepare the data and then edit the script:
[autoCalendar]: DECLARE FIELD DEFINITION Tagged ('$date') FIELDS Dual(Year($1), YearStart($1)) AS [Year] Tagged ('$axis', '$year'), Dual('Q'&Num(Ceil(Num(Month($1))/3)),Num(Ceil(NUM(Month($1))/3),00)) AS [Quarter] Tagged ('$quarter'), Dual(Year($1)&'-Q'&Num(Ceil(Num(Month($1))/3)),QuarterStart($1)) AS [YearQuarter] Tagged ('$axis', '$yearquarter'), Month($1) AS [Month] Tagged ('$month'), Dual(Year($1)&'-'&Month($1), monthstart($1)) AS [YearMonth] Tagged ('$axis', '$yearmonth'), Dual('W'&Num(Week($1),00), Num(Week($1),00)) AS [Week] Tagged ('$weeknumber'), Date(Floor($1)) AS [Date] Tagged ('$date'); DERIVE FIELDS FROM FIELDS [OrderDate] USING [autoCalendar] ;
I included an attachment for you to review.
Please mark the appropriate replies as CORRECT / HELPFUL so our team and other members know that your question(s) has been answered to your satisfaction.
Sales Analysis 2016.qvf 384.0 K