Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

stuhico09
Contributor

Populate result for latest 12 month

I want to show only latest 12 Month. But it show all data. Please help.

This is my dimension:

Month

This is my expression for measure:

sum({$<Month={"$(='>=' & Max(Month-13) & '<=' & Max(Month))"}>} [Number of Project])


Capture.JPG

1 Solution

Accepted Solutions
thiago_justen
Valued Contributor III

Re: Populate result for latest 12 month

Try this:

sum({$<Month={">=$(=AddMonths (Max(Month),-11))"}>} [Number of Project])


Thiago Justen Teixeira Gonçalves
WhatsApp: 24 98152-1675
Skype: justen.thiago
3 Replies
devarasu07
Honored Contributor II

Re: Populate result for latest 12 month

Hi,

try this

step1 : convert date in load script

load *, Date(Date#(Month,'M/D/YYYY'),'D/M/YYYY') as Date;

LOAD * INLINE [

    Month, Number of Project

    1/1/2017, 10

    2/1/2017, 13

    3/1/2017, 10

    4/1/2017, 21

    5/1/2017, 10

    6/1/2017, 21

    7/1/2017, 10

    8/1/2017, 21

    9/1/2017, 21

    10/1/2017, 10

    11/1/2017, 21

    12/1/2017, 21

    1/1/2018, 10

    2/1/2018, 21

    3/1/2018, 13 

];

2) use below set expression

Sum({$<Date={">=$(=MonthStart(Max(Date), -11))<=$(=Date(Max(Date)))"}>} [Number of Project])

above expression will return current + last 11 month

note: if you wish have only last 12 month and not including the current month. then try to adjust the lesser than operation like below

Sum({$<Date={">=$(=MonthStart(Max(Date), -12))<$(=Date(Max(Date)))"}>} [Number of Project])

Capture.JPG

kiko1955
New Contributor

Re: Populate result for latest 12 month

Change this Max(Month-13) for Max(Month)-13

thiago_justen
Valued Contributor III

Re: Populate result for latest 12 month

Try this:

sum({$<Month={">=$(=AddMonths (Max(Month),-11))"}>} [Number of Project])


Thiago Justen Teixeira Gonçalves
WhatsApp: 24 98152-1675
Skype: justen.thiago
Community Browser