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: 
migueldelval
Specialist
Specialist

Sort Moth

Hi all,

I have this Dimmension:

=IF( FLAG_LAST_WEEK_MONTH='1', left(MONTH_NUMBER,3)&'-'&(YEAR_NUMBER) ).

But my months aren´t sorted, they are like Picture.

And I need to sort them, in normal order.

Could some body help me?

Regards

Miguel del Valle

1 Solution

Accepted Solutions
sunny_talwar

Can you check the environmental variable in the script? See if you have this?

SET MonthNames='Ene;Feb;Mar;Abr;May;Jun;Jul;Ago;Sep;Oct;Nov;Dic';

View solution in original post

15 Replies
SunilChauhan
Champion II
Champion II

in exp of sort tab

num(MONTH_NUMBER)&YEAR_NUMBER

Sunil Chauhan
Anonymous
Not applicable

try in tab sort

using Expression

makedate(year_number, month_number) and sort ascending

what is the Content of your month_number as you take onle left 3 characters?

maybe it is easier if it contains complet date?

migueldelval
Specialist
Specialist
Author

Hi Sunil,

No, I have tested this option and it´s not make anything

Regards

Miguel del Valle

sunny_talwar

Try this:

=Date(Date#(If( FLAG_LAST_WEEK_MONTH = '1', Left(MONTH_NUMBER,3) & '-' & (YEAR_NUMBER)), 'MMM-YYYY'), 'MMM-YYYY')

migueldelval
Specialist
Specialist
Author

Hi Rudolf,

-Month_Number: January, Fe...(Name field it´s wrong I Know but....)

-YEAR_NUMBER: 2014, 2015 & 2016

Your option it´s not correct too.

If it helps my expression its:

=Sum({<WEEK_FIELD={">=$(=WeekStart(Max(WEEK_FIELD)-365))<=$(=Max(WEEK_FIELD))"}>}CONTACTS)

I need to make this because my WEEK_FIELD it´s really Monday date (16/05/2016). I have diferents charts with diferents times selection.

Regards

Miguel del Valle

migueldelval
Specialist
Specialist
Author

Hi Sunny,

Your answer isn´t making anything

I´ve used my expression in a Sort Expression  And it change a little bit but isn´t correct.

Regards

Miguel del Valle

sunny_talwar

Try using this in place of your calculated dimension

=Date(Date#(If( FLAG_LAST_WEEK_MONTH = '1', Left(MONTH_NUMBER,3) & '-' & (YEAR_NUMBER)), 'MMM-YYYY'), 'MMM-YYYY')

and then sort numerically

Anonymous
Not applicable

try this in sort field

date#(left(Month_Number,3)&YEAR_NUMBER,'MMMYYYY')

migueldelval
Specialist
Specialist
Author

Hi Sunny T,

Thanks, your are close to solution.

Now Months are sort correctly. BUT I only can see 9 Months. I might to see 13 months.

I am using the next expression.

=Sum({<WEEK_FIELD={">=$(=WeekStart(Max(WEEK_FIELD)-365))<=$(=Max(WEEK_FIELD))"}>}CONTACTS)


Regards


Miguel del Valle