Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
gauthamchilled
Creator
Creator

Monthend function shows monthstart date...strange behaviour in legend

I used dimension scale in axes tab...I used monthend function but it shows as monthstart in chart..can anyone one look and help?

14 Replies
jagan
Luminary Alumni
Luminary Alumni

Hi Gautam,

You cannot control it from the Axes tab, the best option is to bring the new MonthEnd date field in the script and use it in the chart as dimension

Data:

LOAD

*,

MonthEnd(DateField) AS MonthEndDate;

LOAD Repeat(chr(64 + Ceil(Rand() * 5)), 5) AS ID,

  Date(Date('01/01/2010' + Ceil(Rand() * 730))) AS DateField,

  Ceil(Rand() * 10000) AS Amt

AUTOGENERATE 100;

Hope this helps you.

Regards,

Jagan.

jagan
Luminary Alumni
Luminary Alumni

Also uncheck the Continuous option in Axes tab for Dimension.

Hope this helps you.

Regards,

Jagan.

gauthamchilled
Creator
Creator
Author

Jagan,

Thanks for your reply.

But my requirement is I want to show all data of a month in the chart, if I use monthend..it will then pick the data for that monthend data..right?

I just want to limit the legends by showing only monthend with all the data.

settu_periasamy
Master III
Master III

Hi,

May you can create the Calculated dimension like

MonthEnd(DateField)

You can give the Set expression for limited display Month Data.

gauthamchilled
Creator
Creator
Author

Settu,

I understand your file. But yours sums up the data per month. I want day wise data but show legends as monthend. something like the screenshot below.

gauthamchilled
Creator
Creator
Author

I am not understanding why monthend function shows monthstart date in scale axis for dimension in my attached document.

jagan
Luminary Alumni
Luminary Alumni

Hi,

If you want to display only Monthend data then use below script

Data:

LOAD

*,

If(MonthEnd(DateField) = DateField, 1, 0) AS MonthEndFlag;

LOAD Repeat(chr(64 + Ceil(Rand() * 5)), 5) AS ID,

  Date(Date('01/01/2010' + Ceil(Rand() * 730))) AS DateField,

  Ceil(Rand() * 10000) AS Amt

AUTOGENERATE 100;

Now in chart

Dimension: DateField

Expression: =Sum({<MonthEndFlag = {1}>}Amt)

Axes tab is display the range of values, it is not possible to change the dimension values.

Hope this helps you.

Regards,

Jagan.

preminqlik
Specialist II
Specialist II

i guess you require monthend date to select only monthend dates among all the dates

find the below code

Data:

LOAD Repeat(chr(64 + Ceil(Rand() * 5)), 5) AS ID,

  Num(Date('01/01/2010' + Ceil(Rand() * 730))) AS DateField,

  Ceil(Rand() * 10000) AS Amt

AUTOGENERATE 100;

MONTHENDDATESTABLE:

Load Distinct Monthend(DateField) as DateField,

Monthend(DateField) as Monthend

Resident Data;

gauthamchilled
Creator
Creator
Author

Hi Jagan,

No, I want to show all the data in the chart, not just the monthend date data. but in the legen I want to show monthends with scales like I shown in the screenshot above.