Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
anindya_manna
Partner - Creator II
Partner - Creator II

Convert this expression into set expression

Below expression is for calculating previous month.

=date(AddMonths(date#(max([FSPM Month Number]),'YYYYMM'),-1),'YYYYMM')

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
agigliotti
Partner - Champion
Partner - Champion

sorry

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

View solution in original post

13 Replies
agigliotti
Partner - Champion
Partner - Champion

try using this expression:

=date(AddMonths(date#(max( {1} [FSPM Month Number]),'YYYYMM'),-1),'YYYYMM')

sunny_talwar

Can be simplified to this

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

anindya_manna
Partner - Creator II
Partner - Creator II
Author

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.

anindya_manna
Partner - Creator II
Partner - Creator II
Author

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.

anindya_manna
Partner - Creator II
Partner - Creator II
Author

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.

sunny_talwar

May be this

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

agigliotti
Partner - Champion
Partner - Champion

try using this expression:

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

anindya_manna
Partner - Creator II
Partner - Creator II
Author

Its not working.

it displaying 245203.Also  date selection not affecting the result

sunny_talwar

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