Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

sudeep_d
Contributor

monthname sorting issue

Hi,

i want the amount monthwise which i want to sort it for last 12 months.

eg: if the current month is june, then the order should be

jul,aug,sep,oct,nov,dec,jan,feb,mar,apr,may,jun

where jul to mar is fisc year 2011 and apr to jun is fisc year 2012

any help would be appereciated

regards

sudeep

7 Replies
Not applicable

Re: monthname sorting issue

Hi Sudeep,

You need to sort the data on basis of month . And change the format of the expression to Date in "Number" Tab.

i.e Expression should be month and its Number format should be date

This wil help and sort the data.

Thanks

Supriya

sudeep_d
Contributor

Re: monthname sorting issue

Hi Supriya,

if my measure field is 'amount' and dimension field is 'month1' then can u give me steps to give me a bar chart which starts from july of previous fiscal year and ends at june of current fiscal year..i.e last 12 months

thanks

MVP
MVP

Re: monthname sorting issue

sudeep.d

I would suggest that yoou create your month field in the script with the monthstart date as numerical representation, maybe using the MonthName() function, or if you want to closer control the textual ouput maybe using

Date(MonthStart(Date),'MMM YY') as Month

or

Date(MonthStart(Date),'MMM') as Month

Then in your chart, you could use this dimension and something like

=sum({<Date = {">$(=addmonths(monthend(today()),-12))<=$(=today())"}>} Value)

as expression to limit the values shown to the last 12 months (this might need to be adjusted to your requirements a bit).

See also attached.

Stefan

giakoum
Honored Contributor II

Re: monthname sorting issue

in your load script, use the dual function to assign an order to the month :

Dual(monthname, order) .....

Then you can sort by numeric sorting in you chart. The special thing here is that you cannot use month number for sort, you need to use month number - current month number + 1

For example:

August is 8 and now it is August so the order would be 8 - 8 + 1 = 1

September is 9 and now it is August so the order would be 9 - 8 + 1 = 2

etc.

giakoum
Honored Contributor II

Re: monthname sorting issue

Another solution would be to create a YearMonth field and order by that (like 201408).

Re: monthname sorting issue

Hi,

another solution:

QlikCommunity_Thread_55622_Pic1.JPG.jpg

QlikCommunity_Thread_55622_Pic2.JPG.jpg

QlikCommunity_Thread_55622_Pic3.JPG.jpg

hope this helps

regards

Marco

Not applicable

Re: monthname sorting issue

For the sorting issue I got the solution.

As your dimension take:

MonthName(YourDateField)

and everything will sort correct.

Best regards!

Moritz

Community Browser