Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Getting data based on month irrespective of Date Selected

Hi Gurus,

I got stuck in a Scenario where i need to get data in a manner that whatever the date selected in a calendar month the it has to fetch the data in based on the month selected rather than date because the client is tracking on a month basis and providing data in summarized manner with month end date as scenario. and the client want the calendar object as well to input dates.

The basic Problem i got stuck to populate the month value irrespective of date selected in the particular month.

Can i know how to fix this???

Thanks

MRKachhiaIMPdvqlikviewtresescogwassenaarjagancelambarasanScriptingApp Developmentgwassenaarswuehlmassimo.morelli

4 Replies

Re: Getting data based on month irrespective of Date Selected

Hi,

Create MonthYear Field in Script using MonthName()

then in Set analysis try like

Sum({<MonthName={"$(=MonthYear(YourDateField))"},YourDateField=>}Sales)

YourDateField is your selection date Field.

Regards

Regards,
Prashant Sangle
Not applicable

Re: Getting data based on month irrespective of Date Selected

Thank you... will check and update how it went,

Can you help me with, what if i want to find the previous month data

Thanks.

Re: Getting data based on month irrespective of Date Selected

Hi,

Use Addmonth()

like AddMonth(dateField,-1)

Regards,

Regards,
Prashant Sangle
MVP
MVP

Re: Getting data based on month irrespective of Date Selected

Hi,

Try like this

For Current Month

Sum({<MonthFieldNameName=, DateFieldName={'>=$(=MonthStart(Max(DateFieldName)))<=$(=Date(Max(Today())))'}>}Sales)


For Previous Month

For Current Month

Sum({<MonthFieldNameName=, DateFieldName={'>=$(=MonthStart(Max(DateFieldName), -1))<=$(=MonthEnd(Max(Today()), -1))'}>}Sales)

Community Browser