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.
Not applicable

IF & GetFieldSelections

Hi all,

I am trying to create a formula which selects the expression based on whether a field has been selected or not.

The aim is to show previous YTD (e.g. sum({<_YTD_PY={1}>} [Total Discount])), however when a user selects another year, the formula would instead show sum([Total Discount]).


Currently I have:

IF(

  GetSelectedCount(Year)=0,

    sum({<_YTD_TY={1}>} [Total Discount]),

        sum([Total Discount])

)

This formula works if no year is selected, however if a year is selected it will only show 0.

Any help would be much appreciated.

Thank you in advance.

2 Replies
galax_allu
Not applicable

Re: IF & GetFieldSelections

Hi

try this

if (aggr(sum(1),year)>0,  sum({<_YTD_TY={1}>} [Total Discount]),   sum([Total Discount]))

sunny_talwar
Not applicable

Re: IF & GetFieldSelections

Why do you think that the expression will show 0 when you have the year is selected? I think it should show the Sum for the particular year selected? Have you tried it out yet?