# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Contributor

## Convert this expression into set expression

Below expression is for calculating previous month.

I want to calculate previous month based on date filter. It should not affected by any other selection like product name and rep id.

Bu using above normal exp. previous month calculation is changing as per selection like product name and rep id

1 Solution

Accepted Solutions
Honored Contributor II

## Re: Convert this expression into set expression

sorry

=date(AddMonths(date#(max( {1< [FSPM Month Number] = \$::[FSPM Month Number]>}  [FSPM Month Number]),'YYYYMM'),-1),'YYYYMM')

13 Replies
Honored Contributor II

## Re: Convert this expression into set expression

try using this expression:

MVP

## Re: Convert this expression into set expression

Can be simplified to this

Contributor

## Re: Convert this expression into set expression

I want to date selection will change the calculation but not rep id or product name field.

if I choose  05/05/2017 then prev moth should be 201704.Date filter should work but not other filter effect the result.

Contributor

## Re: Convert this expression into set expression

I want to date selection will change the calculation but not rep id or product name field.

if I choose  05/05/2017 then prev moth should be 201704.Date filter should work but not other filter effect the result.

Contributor

## Re: Convert this expression into set expression

I want to date selection will change the calculation but not rep id or product name field.

if I choose  05/05/2017 then prev moth should be 201704.Date filter should work but not other filter effect the result.

MVP

## Re: Convert this expression into set expression

May be this

=Date(AddMonths(Max({1<[FSPM Month Number] = p([FSPM Month Number])>} [FSPM Month Number]), -1),'YYYYMM')

Honored Contributor II

## Re: Convert this expression into set expression

try using this expression:

=date(AddMonths(date#(max( {1< [FSPM Month Number] = ::\$ [FSPM Month Number]>}  [FSPM Month Number]),'YYYYMM'),-1),'YYYYMM')

Contributor

## Re: Convert this expression into set expression

Its not working.

it displaying 245203.Also  date selection not affecting the result

MVP

## Re: Convert this expression into set expression

Would you be able to share a sample to look at this?