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: 
Not applicable

How to change date format

Hello all,

My data currently has the date listed in the following format:

Jan 29, 2017 22:01:46 EST

I'm trying to change it so it only has 1/29/2017 with no time stamp. How would I accomplish this?

Also, I'm trying to set an expression for when the date is within the last 14 days, display all the data with severity = 'high'

thank you in advance!

22 Replies
Not applicable
Author

New first discovered is the date field.

its complicated. I have two qvd's i'm pulling information from. New data and Closed data

for the chart, i want a stacked bar graph, with the severity on the x axis (high and low) and the stacks to show New data and Closed data.

I also want to break down the x axis by time frame (0-14 days, 15-30 days, etc) please see picture attached.IMG_1893.JPG

sunny_talwar

You want this High Low flag in comparison to Today's date?

Not applicable
Author

yes, in comparison to the date it was created.

sunny_talwar

So the below date in comparison to today?

Date(Floor(TimeStamp#(SubField(DateField, ' E', 1), 'MMM DD, YYYY hh:mm:ss'))) as Date

May be this

LOAD *,

     If(CreatedDate <= Today() - 14, 1, 0) as Flag;

LOAD Date(Floor(TimeStamp#(SubField(DateField, ' E', 1), 'MMM DD, YYYY hh:mm:ss'))) as Date

          YourOtherDataFields

FROM ....;

Now whichever row has Flag = 1, it is the row where CreatedDate is within 14 days of Today(). and where ever it is 0, the created date is older than 14 days from today

Not applicable
Author

so if this is in my load script, how would I create the same pattern for 15-30 days, 31-90, and 91-180+?

and what would I put in my expression?

sunny_talwar

Same idea....

LOAD *,

    If(Today() - CreatedDate <= 14, Dual('0-14 days', 1),

    If(Today() - CreatedDate <= 30, Dual('15-30 days', 2),

    If(Today() - CreatedDate <= 90, Dual('31-90 days', 3), Dual('91-180+ days', 4)))) as Flag;

LOAD Date(Floor(TimeStamp#(SubField(DateField, ' E', 1), 'MMM DD, YYYY hh:mm:ss'))) as Date

          YourOtherDataFields

FROM ....;

Not applicable
Author

okay got it, but then how do i set up my expressions in the bar chart?

sunny_talwar

Seems like you need three dimensions

Dimension

Flag

Severity

ClosedData/NewData Field

Expression

Count/Sum expression

Not applicable
Author

hm, Flag is only pulling 91-180+ days.

so closed/open doesn't have a field. its two documents, one with data from all the open fields, and one document with all the closed fields. How would I use that for a dimension? I'm confused for what I should be counting in the expression

sunny_talwar

I think it is difficult to understand and know what you have. Would you be able to share the app you are working with?