Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
olguita2014
Contributor

Date Range

Hi,

I want to select year and month, for example year=2017 and month=January.

And in the advanced expression, to show data since January 2016 to January 2017.

Currently my expression is: 

COUNT(distinct {<[Año_Emision_Poliza]={">=$(=Max(Año)-1)<=$(=Max(Año))"}>}Cod_Contratante)

But It does not work when I select the month

Please help me!!!!!!!!!!

1 Solution

Accepted Solutions
aarkay29
Valued Contributor

Re: Date Range

Something like this should work

=COUNT(distinct {<[DateField]={">=$(=MonthStart(AddMonths(Max([DateField]),-12)))<=$(=MonthEnd(Max([DateField])))"},[Month]=>}Cod_Contratante)

5 Replies
aarkay29
Valued Contributor

Re: Date Range

Try this

COUNT(distinct {<[Año_Emision_Poliza]={">=$(=Max(Año)-1)<=$(=Max(Año))"},Month=>}Cod_Contratante)

olguita2014
Contributor

Re: Date Range

Hi,

I want select month, no eliminate Month

aarkay29
Valued Contributor

Re: Date Range

If you want to select month and get values!


COUNT(distinct {<[Año_Emision_Poliza]={">=$(=Max(Año)-1)<=$(=Max(Año))"}>}Cod_Contratante)


Can you please tell me, What do yo mean by the above expression of yours not working??

olguita2014
Contributor

Re: Date Range

This expresion is correct but I want since January 2016 to January 2017 or since February 2016 to February 2017,

since March 2016 to March 2017.


Depend of my selection of Month and Year.


if I select January 2017, in my expression I need to show data since January 2016 to January 2017

aarkay29
Valued Contributor

Re: Date Range

Something like this should work

=COUNT(distinct {<[DateField]={">=$(=MonthStart(AddMonths(Max([DateField]),-12)))<=$(=MonthEnd(Max([DateField])))"},[Month]=>}Cod_Contratante)