Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
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
Anonymous
Not applicable
Author

Hi

try this

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

sunny_talwar

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?