Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Sorting Month-Year by Month Name

In my chart, the data is all correct but my dimension is not sorting correctly.

=if(date(renewal_dt) <= date(GetFieldSelections(prod_dt))+182.5 and month(renewal_dt) <> month(GetFieldSelections(prod_dt)), month(renewal_dt) &' '& year(renewal_dt),

if(renewal_dt > GetFieldSelections(prod_dt), year(renewal_dt),))

This is the dimension. It displays the next six months and then after that, just the years, based on whatever production date is chosen. Attached is a snapshot of how the dimension is displayed when I sort just numerically and have 10/31/15 selected as the production date.

The years are in the correct order but the Months are not and that is what I am struggling with

1 Solution

Accepted Solutions
sunny_talwar

Can you try this as your calculated dimension instead?

=If(Date(renewal_dt) <= Date(GetFieldSelections(prod_dt)) +182.5 and Month(renewal_dt) <> Month(GetFieldSelections(prod_dt)), MonthName(renewal_dt),

If(renewal_dt > GetFieldSelections(prod_dt),

Dual(Year(renewal_dt), Year(renewal_dt) * 100)))

View solution in original post

12 Replies
Anonymous
Not applicable
Author

in sort tab to sort the in expression or have the option in the other options also

krishnacbe
Partner - Specialist III
Partner - Specialist III

Hi,

Sort using expression option in the Sort Tab. Create a inline table to make the order and use it in the sort tab.

Anonymous
Not applicable
Author

What would the inline table look like, if you dont mind?

krishnacbe
Partner - Specialist III
Partner - Specialist III

Inline should be like below. you need to map the month column with your month column and then sort based on MonthID

LOAD * INLINE [
MonthID, Month
1, Jan
2, Feb
3, Mar
4, Apr
5, May
6, Jun
7, Jul
8, Aug
9, Sep
10, Oct
11, Nov
12, Dec
]
;

sunny_talwar

Can you try this as your calculated dimension instead?

=If(Date(renewal_dt) <= Date(GetFieldSelections(prod_dt)) +182.5 and Month(renewal_dt) <> Month(GetFieldSelections(prod_dt)), MonthName(renewal_dt),

If(renewal_dt > GetFieldSelections(prod_dt),

Dual(Year(renewal_dt), Year(renewal_dt) * 100)))

Anonymous
Not applicable
Author

This did not work

sunny_talwar

Would you be able to elaborate what it did? Did not work is not useful and doesn't tell me what I might have done incorrectly

Anonymous
Not applicable
Author

It changed nothing, the columns rows stayed the same. I even messed with the sort and still nothing changed.

sunny_talwar

So after you used this, you did use the numerical sort order and it still did not work? Would you be able to share a sample?