Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
suvechha_b
Creator III
Creator 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
MK_QSL
MVP
MVP

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

tresesco
MVP
MVP

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?

its_anandrjs
Champion III
Champion III

Write like

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

Not applicable

you can use

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


for subtracting a month from the date field


himank



suvechha_b
Creator III
Creator III
Author

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...

suvechha_b
Creator III
Creator III
Author

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.........

tresesco
MVP
MVP

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]).

suvechha_b
Creator III
Creator III
Author

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......

Not applicable

can you share the sample qvw?