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

Sort by Month

In my load script, I create a YearMonth field as follows: date(feeddate,'YYYYMM') as YearMonth.  I have another field, AsOfYearMonth, that is equal to YearMonth.  In my report, I have this calculated dimension - =date(AsOfYearMonth,'MMM').  The report output so far looks like this:

=date(AsOfYearMonth,'MMM')
//=dual(text(date(AsOfYearMonth,'MMM')),
//num(month(AsOfYearMonth)))
//=Month(AsOfYearMonth)
2011 Total Voluntarydual(text(date(AsOfYearMonth,'MMM')),
num(month(AsOfYearMonth)))
Feb7.4%2
Mar15.4%3
May11.6%5
Sep-9
Apr-4
Oct-10
May-5
Mar-3
Jan14.3%1
Dec-12
Feb-2
Apr14.1%4
Jun-6
Jul-7
Jun11.1%6
Nov-11
Aug-8
Jan-1


My problem is that some months (Jan, Feb, Mar, Apr, May, Jun) are repeating, instead of consolidating onto one line. I suspect that this is due to the actual value behind each month.  How can I force these repeating months onto the same line?
5 Replies
erichshiino
Partner - Master
Partner - Master

Hi,

Try to create a field in the script with the syntax:

month(feeddate) as Month,

or date(month(feeddate),'MMM') as Month

In your case, I'd say your are right, you have a value with month and year behind the dimension, even if you format it in a different way.

Hope this helps,

Erich

Not applicable
Author

Create a Field Month(Date) as MonthName in your Date Dimension and use that.

Not applicable
Author

Thank you.  In both cases, this should be done in the load script, not in the report itself, correct?

erichshiino
Partner - Master
Partner - Master

Yes, that you go in the script.

You can also include the month as an integer if you still have problems to sort it

num(month(date)) as nMonth

Hope it helps,

Erich

Not applicable
Author

Thank you both.  That worked.