Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Need help removing IF statement in front of Set Analysis

Can someone please help me figure out how to get rid of this IF statement in the beginning of my SET analysis?

This script works fine and returns the correct values:

=if(MonthYear= date($(=max(MonthYear)),'MMM-YYYY'),
    sum({$<
        CheckYear = {$(=Max(CheckYear))},
        PrimaryPositionYN={1},
        EarningsHistoryYN -= {1},
        NonCashYN = {0}
        >}
    [Current Earnings])
)

Any help would be appreciated.

1 Solution

Accepted Solutions
PrashantSangle

Hi,

It depends what kind dimension you are using, If you are using MonthYear as Dimension also then you have to use that if statement .

If you are not using as dimension then

try

sum({$<

        MonthYear={"$(=date(max(MonthYear),'MMM-YYYY'))"}
        CheckYear = {$(=Max(CheckYear))},
        PrimaryPositionYN={1},
        EarningsHistoryYN -= {1},
         NonCashYN = {0}
>}
[Current Earnings])

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

View solution in original post

2 Replies
anbu1984
Master III
Master III

Do you want calculate Sum for all MonthYear? Then try this

sum({$<

        CheckYear = {$(=Max(CheckYear))},

        PrimaryPositionYN={1},

        EarningsHistoryYN -= {1},

        NonCashYN = {0}

        >}

    [Current Earnings])

PrashantSangle

Hi,

It depends what kind dimension you are using, If you are using MonthYear as Dimension also then you have to use that if statement .

If you are not using as dimension then

try

sum({$<

        MonthYear={"$(=date(max(MonthYear),'MMM-YYYY'))"}
        CheckYear = {$(=Max(CheckYear))},
        PrimaryPositionYN={1},
        EarningsHistoryYN -= {1},
         NonCashYN = {0}
>}
[Current Earnings])

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂