Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
sourabhsharma
Partner - Contributor II
Partner - Contributor II

Order by on order date not working

Orders:
load
CustomerID,
EmployeeID ,
Freight,
Date(Date#(OrderDate,'M/DD/YYYY'),'M/DD/YYYY') AS OrderDate,
Year(OrderDate) As Year,
Month(OrderDate) ,
Day(OrderDate) ,
ApplyMap('Quarters_map',Num(Month(OrderDate),Null())) As Quarter,
// Date(Monthstart(OrderDate),'MMMYYYY') As MonthYear,
OrderID,
OrderID As OrderIDCounter,
ShipperID,
ApplyMap('Shippers_map',ShipperID,'MISSING') As Shipper
//if(CustomerID=peek('CustomerID'),peek('OrderDate'),OrderDate) As LastOrderDate
resident orders
order by OrderDate ASC;

1 Solution

Accepted Solutions
Vegar
MVP
MVP

What's the problem with your statement?

What output do you get from that load statement and what is your expected output?

View solution in original post

3 Replies
Vegar
MVP
MVP

What's the problem with your statement?

What output do you get from that load statement and what is your expected output?

hanna_choi
Partner - Creator
Partner - Creator

Hello Sourabhsharma

I guess this statement can not recognize the OrderDate's data type as Date.

How about you use below statement?

---------------------

Orders_Temp:
load
 CustomerID,
 EmployeeID ,
 Freight,
 Date(Date#(OrderDate,'M/DD/YYYY'),'M/DD/YYYY') AS OrderDate,
 Year(OrderDate) As Year,
 Month(OrderDate) ,
 Day(OrderDate) ,
 ApplyMap('Quarters_map',Num(Month(OrderDate),Null())) As Quarter,
 // Date(Monthstart(OrderDate),'MMMYYYY') As MonthYear,
 OrderID,
 OrderID As OrderIDCounter,
 ShipperID,
 ApplyMap('Shippers_map',ShipperID,'MISSING') As Shipper
//if(CustomerID=peek('CustomerID'),peek('OrderDate'),OrderDate) As LastOrderDate
resident Sourcetable;

Order:
load
 CustomerID,
 EmployeeID ,
 Freight,
 OrderDate,
 Year,
 Month,
 Day,
 Quarter,
 OrderID,
 OrderIDCounter,
 ShipperID,
 Shipper
resident Orders_Temp
order by OrderDate ASC;

drop table Orders_Temp;

----------------------------

Best Regard

Hanna.choi

 

 

 

maldiv097
Contributor
Contributor

Is that’s the same thing Amazon does? I just searched something there too. Regular results gave me 5,097 results. Sort from low to high, and it’s now 88 results. I’m starting to feel like I’m missing some giant blinking sign.