# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

## If statement combined with set analysis

Hi everyone!

Im new to qlik sense and having problems with combining set analysis with an if statement. I am making a line chart and only want the last twelve months to be shown, but I also want a filter on a dimension. Its when Im adding the if statement that it stops working.

CustomerGroup=Numeric dimension

Indicator=Sum(NBCustomer)

This part works seperatly:

Kind regards,

Sofia

Tags (1)
1 Solution

Accepted Solutions
Valued Contributor

## Re: If statement combined with set analysis

8 Replies
Honored Contributor II

## Re: If statement combined with set analysis

please tell us which dimensions and measures you are using in line chart.

Not applicable

## Re: If statement combined with set analysis

Hello!

CustomerGroup=Numeric dimension

Indicator=Sum(NBCustomer)

Date=date dimension

Honored Contributor II

## Re: If statement combined with set analysis

why you need to use IF ?

Not applicable

## Re: If statement combined with set analysis

I probably dont! If you have a better way I would very much appreciate it!

Kind regards,

Sofia

Valued Contributor

Employee

## Re: If statement combined with set analysis

Honored Contributor II

## Re: If statement combined with set analysis

you can use set analysis also for CustomerGroup like below:

Sum({\$<Month=, Year=, Date={">=\$(=MonthStart(AddMonths(Max(Date),-12)))<\$(=MonthEnd(Max(Date)))"}, CustomerGroup = {"1"} >} [NbCustomer])

this will only filter CustomerGroup  = 1 regardless which CustomerGroup you selected, else you can use CustomerGroup *= {"1"} to take care also of CustomerGroup selections.

Not applicable

## Re: If statement combined with set analysis

Thank you everyone! Now it works.

Kind regards,

Sofia