Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Make your voice heard! Participate in the 2020 Wisdom of Crowds® Survey. BEGIN SURVEY
Highlighted
suvechha_b
Contributor III

Need Help to write the expression.

How can I write the expression :

SUM({<[Forecast Fiscal Month] = {'$(=([Forecast Fiscal Month],-1))'}>}[Stag Forecast Units])

19 Replies
Highlighted
MVP
MVP

Re: Need Help to write the expression.

SUM({<[Forecast Fiscal Month] = {"$(=Max([Forecast Fiscal Month])-1)"}>}[Stag Forecast Units])

Highlighted
MVP
MVP

Re: Need Help to write the expression.

It depends on how the data look like in your field [Forecast Fiscal Month], like 'Jan', 'Feb' ..., or 1,2,...? If like 'Jan', ..then,is it created using month() in the script or simply a string represenattion?

Highlighted

Re: Need Help to write the expression.

Write like

=SUM({<[Forecast Fiscal Month] = {$(=Max([Forecast Fiscal Month])-1)}>} [Stag Forecast Units])

Highlighted
Not applicable

Re: Need Help to write the expression.

you can use

SUM({<[Forecast Fiscal Month] = {'$(=(Month(Addmonths(Date,-1)))'}>}[Stag Forecast Units]).


for subtracting a month from the date field


himank



Highlighted
suvechha_b
Contributor III

Re: Re: Need Help to write the expression.

The data has to calculated through the period

  Jul 2013 Aug 2013 Sep 2013 .......................Jun 2014

Sample : =SUM({<[fis_month] = {$(=Max([Forecast Fiscal Month])-1)}>} [Stag Forecast Units])

is not working...

Highlighted
suvechha_b
Contributor III

Re: Re: Need Help to write the expression.

The data has to calculated through the period

      Jul 2013  Aug 2013      Sep 2013      .......................  Jun 2014  

Sample : SUM({<[fis_month] = {'$(=(Month(Addmonths(Forecast Fiscal Month,-1)))'}>}[Stag Forecast Units])

is not working...

PFA..

My data looks like that.........

Highlighted
MVP
MVP

Re: Need Help to write the expression.

Then, try like:

SUM({<[Forecast Fiscal Month] = {'$(=(MonthName(Addmonths(Date,-1)))'}>}[Stag Forecast Units]).

Update:

Missed the max(). Try=SUM({<[Forecast Fiscal Month] = {'$(=(MonthName(Addmonths(Max([Forecast Fiscal Month]),-1)))'}>}[Stag Forecast Units]).

Highlighted
suvechha_b
Contributor III

Re: Re: Need Help to write the expression.

The data has to calculated through the period

  Jul 2013 Aug 2013 Sep 2013 .......................Jun 2014

Sample : =SUM({<[fis_month] = {$(=Max([Forecast Fiscal Month])-1)}>} [Stag Forecast Units])

is not working...

PFA ...My data looks like that......

Highlighted
Not applicable

Re: Need Help to write the expression.

can you share the sample qvw?