# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Contributor

## Set Analysis Using alternate states

Hello Community,

I found the extension to Qlik Sense to use Alternative states.

In the Example they show this way

Sum(Sales) - For main group

Sum({Alt} Sales- for comparison group.

I already created the group but i have a doubt.

I want to do this

Sum({\$<Year={'\$(vMaxYear)'}>} Sales) for main group

=Sum({Alte}{\$<Year={'\$(vMaxYear)'}>} Sales) - for comparison group

Anyone can help me in syntax?

Bruno Paulo

1 Solution

Accepted Solutions
MVP

## Re: Set Analysis Using alternate states

Try this

=Sum({Alte<Year={'\$(vMaxYear)'}>} Sales)

10 Replies
MVP

## Re: Set Analysis Using alternate states

Try this

=Sum({Alte<Year={'\$(vMaxYear)'}>} Sales)

Contributor

## Re: Set Analysis Using alternate states

And just complicating a bit

=Sum({\$<Year={'\$(vMaxYear)'}>} Sales)

/

Sum(Total{\$<Year={'\$(vMaxYear)'}>} Sales)

and

=Sum({Alte<Year={'\$(vMaxYear)'}>} Sales)

/

Sum(Total{Alte<Year={'\$(vMaxYear)'}>} Sales)

the second one is wrong can u help me?

Thank you for the perfect anwser on the 1st one.

Regards

Bruno

MVP

## Re: Set Analysis Using alternate states

Looks right.... can you share the image of what you getting with both the expressions?

Contributor

## Re: Set Analysis Using alternate states

I'm getting 100% on second expression

MVP

## Re: Set Analysis Using alternate states

You have year as your chart dimension?

Contributor

## Re: Set Analysis Using alternate states

Isn't a bar chart its a KPI object

MVP

## Re: Set Analysis Using alternate states

TOTAL qualifier does nothing in a KPI object... so you are basically dividing the same number in the numerator by the same number in the denominator to get 1 (or 100%)... what is the goal here?

Contributor

## Re: Set Analysis Using alternate states

I know, but when i select a customer or a product the KPI should give me the percentage of that customer or product in total sales, but when i select it keeps give me 100%

MVP

## Re: Set Analysis Using alternate states

Try this

=Sum({Alte<Year={'\$(vMaxYear)'}>} Sales)

/

Sum({Alte<Year={'\$(vMaxYear)'}, Customer, Product>} Sales)