Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how to create a month

I am having the field calender week from this one i need to create month how to do it

1 Solution

Accepted Solutions
Bill_Britt
Former Employee
Former Employee

Do you have a field that contains a date? If so then the below should work.

Month(Fieldname) as Month,

Orders:

LOAD

applymap('Shippers_Map', ShipperID, 'MISSING') as Shipper,

ShipperID,

CustomerID,

   
EmployeeID,

   
EmployeeID as EmployeeSalesID,

   
Freight,

   
OrderDate,

   
Month(OrderDate) as Month,

   
Year(OrderDate) as Year,

   
Day(OrderDate) as Day,

   
applymap('Quarters_Map', num(Month(OrderDate)), Null()) as Quarter,

   
date(monthstart(OrderDate),'MMM-YYYY') as MonthYear,

   
OrderID,

    1
as OrderIDCounter

;

SQL SELECT *

FROM Orders

order by OrderDate ASC;

Bill

Bill - Principal Technical Support Engineer at Qlik
To help users find verified answers, please don't forget to use the "Accept as Solution" button on any posts that helped you resolve your problem or question.

View solution in original post

2 Replies
Anonymous
Not applicable
Author

hi,

   can you please provide sample data.

Regards

Bill_Britt
Former Employee
Former Employee

Do you have a field that contains a date? If so then the below should work.

Month(Fieldname) as Month,

Orders:

LOAD

applymap('Shippers_Map', ShipperID, 'MISSING') as Shipper,

ShipperID,

CustomerID,

   
EmployeeID,

   
EmployeeID as EmployeeSalesID,

   
Freight,

   
OrderDate,

   
Month(OrderDate) as Month,

   
Year(OrderDate) as Year,

   
Day(OrderDate) as Day,

   
applymap('Quarters_Map', num(Month(OrderDate)), Null()) as Quarter,

   
date(monthstart(OrderDate),'MMM-YYYY') as MonthYear,

   
OrderID,

    1
as OrderIDCounter

;

SQL SELECT *

FROM Orders

order by OrderDate ASC;

Bill

Bill - Principal Technical Support Engineer at Qlik
To help users find verified answers, please don't forget to use the "Accept as Solution" button on any posts that helped you resolve your problem or question.