Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
deniscamh
Creator
Creator

Display Results based on Last Month

Hi all,

I have a pivot table that has Current donor status as a Row Dimension and Fiscal year, Fiscal Quarter and Fiscal Month as Column Dimension. The measure is number of donors, simple expression : count(distinct Donors). Please see screenshot below.Donor Status.JPG

What I am trying to do is for each Fiscal Year instead of showing full year results to show only Last Month result for that Fiscal year and the same for Fiscal Quarter.

What i did so far is created variable vMaxFiscalMonth = Max(FiscalMonth) and added it to expression:

count({<FiscalMonth = {"=$(vMaxFiscalMonth)"}>} distinct Donors).

But the result is still for full year instead of Last Month.If I hard code it, means put 12 instead of variable it works but I cannot hard code it as I need it to be adjusted according to Fiscal year and Fiscal Quarter.

Can anyone let me what I am missing in my expression or any other solution?

Thanks

Denis

45 Replies
agigliotti
Partner - Champion
Partner - Champion

maybe this:

if( Max(FiscalMonth) = Max( TOTAL <FiscalYear> FiscalMonth), count(distinct Donors) )

deniscamh
Creator
Creator
Author

Hi Sunny,

Unfortunately it does not give me the correct results.

Please see belowdonor2.JPG

sunny_talwar

How about this

FirstSortedValue(Aggr(Count(DISTINCT Donors), [Donor Status], [Fiscal Year], [Fiscal Quarter], [Fiscal Month]), -Aggr([Fiscal Month], [Donor Status], [Fiscal Year], [Fiscal Quarter], [Fiscal Month]))

deniscamh
Creator
Creator
Author

Hi Sunny,

It look like it works

My only concern why sometimes it does not display data (look on screenshot)?

How ever if I expand the Fiscal Quarter and Fiscal Month id displays everything.

Without expanding:

donors3.JPG

After Expanding:

donors4.JPG

sunny_talwar

May be try using a DISTINCT....

FirstSortedValue(DISTINCT Aggr(Count(DISTINCT Donors), [Donor Status], [Fiscal Year], [Fiscal Quarter], [Fiscal Month]), -Aggr([Fiscal Month], [Donor Status], [Fiscal Year], [Fiscal Quarter], [Fiscal Month]))

deniscamh
Creator
Creator
Author

Still does not work for 2017-2018, but worked for 2016-2017 though.

Also the totals are incorrect.

donors5.JPG

sunny_talwar

May be you have Fiscal Month in 2017-2018 with no Donor information?

sunny_talwar

You can try this

FirstSortedValue({<Donor = {'*'}>} DISTINCT Aggr(Count(DISTINCT Donors), [Donor Status], [Fiscal Year], [Fiscal Quarter], [Fiscal Month]), -Aggr(Only({<Donor = {'*'}>}[Fiscal Month]), [Donor Status], [Fiscal Year], [Fiscal Quarter], [Fiscal Month]))

deniscamh
Creator
Creator
Author

no i have for every month,

If I expand the year it works.

donors6.JPG

sunny_talwar

What do you get when you use Max([Fiscal Month]) in this chart?