Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

formatting dates

Hi, I have an If statement in my Dimension Expresion box to limit my date dimension to 18 months.

=Date(If(PeriodDate > MonthStart(Today(),-18), PeriodDate, Null()), 'MMM/YYY')

It works in limiting my chart to 18 months but now the dates show as numbers ( 40600 etc ).  How can I get these to show as dates.  The load statements loads the dates as MM/YYYY.    Thanks, Jim

1 Solution

Accepted Solutions
muniyandi
Creator III
Creator III

Hi,

francis your date format as MM/YY Means (you need monthwise result ? )

Set Variable FirstDT, = Date#(DATE(MONTHSTART(TODAY(),-18),'MM/YY')))

Using Dimension expression like:

=IF (Date#(DATE(PeriodDate,'MM/YY')) >Date#(DATE(MONTHSTART(TODAY(),-18),'MM/YY')),Date#(DATE(PeriodDate,'MM/YY')),NULL())

Or

using Variable

=IF (Date#(DATE(PeriodDate,'MM/YY')) >FirstDT,Date#(DATE(PeriodDate,'MM/YY')),NULL())

Hops it will help

Muni

View solution in original post

10 Replies
MayilVahanan

Hi

Try like this

=Date(If(PeriodDate > MonthStart(Today(),-18), PeriodDate), 'MM/YYYY')

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Nicole-Smith

Try:

=If(PeriodDate > MonthStart(Today(),-18), Date(PeriodDate, 'MMM/YYY'), Null())

Not applicable
Author

still get the number. thanks for trying

Not applicable
Author

still getting the number....

MayilVahanan

Hi

     What is the PeriodDate format? is date ? or number? or text?

     Try this , if its text format..Can you post a sample file

     Date#(PeriodDate,'MM/YYYYY')

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

It's stored in my MS SQL table as 'smalldatetime'.  When I load into QV I set date format as MM/YY

MayilVahanan

Hi

=Date(If(PeriodDate > Date(MonthStart(Today(),-18),'MM/YY'), PeriodDate), 'MM/YYYY')

What gives for this:

if(PeriodDate > MonthStart(Today(),-18), PeriodDate) number or date..if date means what format?

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
muniyandi
Creator III
Creator III

Hi,

francis your date format as MM/YY Means (you need monthwise result ? )

Set Variable FirstDT, = Date#(DATE(MONTHSTART(TODAY(),-18),'MM/YY')))

Using Dimension expression like:

=IF (Date#(DATE(PeriodDate,'MM/YY')) >Date#(DATE(MONTHSTART(TODAY(),-18),'MM/YY')),Date#(DATE(PeriodDate,'MM/YY')),NULL())

Or

using Variable

=IF (Date#(DATE(PeriodDate,'MM/YY')) >FirstDT,Date#(DATE(PeriodDate,'MM/YY')),NULL())

Hops it will help

Muni

Anonymous
Not applicable
Author

Looks right.  See number formatting on the front end, in document properties, maybe in object (list box) properties.