Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
tracycrown
Creator III
Creator III

Change Date format

Dear Sir/Madam

Kindly advise how to convert report date YYYYMMDD to following formats in scrip :

1. MMM-YY

2. YYYY

3. MM

4. DD

Thank you

Tracy

20 Replies
mightyqlikers
Creator III
Creator III

PFA

HirisH_V7
Master
Master

Hi,

Check this,

Data:

LOAD      

  Mid(Date,7,8)& '/'& TRim(Left(mid(Date,5,6),2)) & '/'& Mid(Date,1,4) as Date,

  Amount

FROM

[Test (1).xlsx]

(ooxml, embedded labels, table is All);

Front End:

Change Date Format-200497.PNG


HTH,

PFA,

Hirish

HirisH
“Aspire to Inspire before we Expire!”
settu_periasamy
Master III
Master III

Hi,

sunindia‌ suggestion working for me.  You just try to add the Amount Field in your Preceding Load. see below

Table:

   LOAD Date,

  Date(Date, 'MMM-YY') as MonthYear,

  Year(Date) as Year,

  Month(Date) as Month,

  Num(Month(Date)) as MonthNum,

  Day(Date) as Day

Amount;


LOAD Date#(Date,'YYYYMMDD') as Date,

    Amount

FROM

Test.xlsx

(ooxml, embedded labels, table is All);

tracycrown
Creator III
Creator III
Author

Dear Settu

Please advise why Oct-2013 (MMM-YYYY) did not group into one.

   

MonthYearAmount
Feb-20134,200
Jul-20132,500
Aug-20132,000
Oct-201330,000
Oct-2013295
Feb-20142,389
Jul-201415,000

Thank You

Tracy

tracycrown
Creator III
Creator III
Author

Dear Sam

Why the Year (57014) in YearMonth is not correct ?.

Report :

   

YearMonthsum(Amount)
Aug-570144200
Dec-570152500
Apr-570162000
Nov-5701630000
Nov-57016295
Jan-570422389
May-5704315000

Data :

   

DateAmount
201308022000
2013101230000
201307012500
201302154200
20131018295
2014070315000
201402192389

Thank you

Tracy

!

settu_periasamy
Master III
Master III

Hi,

is that table box or Chart, Look at the below screen shot..

Capture.JPG

Attached the sunindia‌ file with 'Amount' Field added..

mightyqlikers
Creator III
Creator III

HI Tracy

what do you mean by 57014,57015...

i am not understanding that thing.

$@M

PradeepReddy
Specialist II
Specialist II

Try like this.. it is working fine for me.. This is same as sunindia , just added the Amount field..

Load Date_Temp as Date,

  Date(Date_Temp,'MMM-YYYY') As 'MMM-YYYY',

  Year(Date_Temp) as 'YYYY',

  Month(Date_Temp) As 'MM',

  Day(Date_Temp) As 'DD',

  Amount;

LOAD Date,

     Date#(Date,'YYYYMMDD') as Date_Temp,

     Amount

FROM Test.xlsx (ooxml, embedded labels, table is All);

maxgro
MVP
MVP

In my test it sorts, this is the chart

1.png

and this the script

Directory;

LOAD Date,

     //Date(Date,'MMM-YYYY') as YearMonth,

     Date(Date#(Date, 'YYYYMMDD'),'MMM-YYYY') as YearMonth,

     Amount

FROM

Test.xlsx

(ooxml, embedded labels, table is All);

tracycrown
Creator III
Creator III
Author

Dear Settu

Not sure why my result in Oct-13 is different from your screen shot, please refer to attached files and advise.

Thank you

Tracy