Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

expression to be calculated based on the selections

Depending upon particular selections i want to add $100 to the Forecast column. Selections that need to be are

Center='RO'

PD='other'

month=12

then sum(forecast) +100 else sum(forecast)

having little bit of difficulty implementing this in the expression so i made a prototype to mimic my requirement.

Thanks in advance.

PFA

1 Solution

Accepted Solutions
maxgro
MVP
MVP

if I understand try (put in a texbox to see the result)

=WildMatch(GetFieldSelections(CM_Month, '@'), '*12*')

or

=WildMatch(Concat(CM_Month, '@'), '*12*')

instead of

GetFieldSelections('Month', 12)

in your expression

View solution in original post

10 Replies
Not applicable
Author

i did try to use this expression

=If((GetFieldSelections(Center)='RO' and PD='other' and CM_Month='12'),(sum(Forecast)+100),Sum(Forecast))

but the issue is when i try to multi pick the month values like 10, 11 & 12 the expression doesn't work the way needed.

Now, the issue have been narrowed down to when i multi pick the month or when ever the month field value has a 12 then for PD=other there should be +100, how can i do this?

MK_QSL
MVP
MVP

IF(GetFieldSelections(Center)='RO' and PD = 'other' and GetFieldSelections(CM_Month)=12, SUM(Forecast)+100,SUM(Forecast))

maxgro
MVP
MVP

if I understand try (put in a texbox to see the result)

=WildMatch(GetFieldSelections(CM_Month, '@'), '*12*')

or

=WildMatch(Concat(CM_Month, '@'), '*12*')

instead of

GetFieldSelections('Month', 12)

in your expression

goncalo_ricardo_pereira
Partner - Contributor III
Partner - Contributor III

Hello Dinesh,

Try this expression.

=if((GetSelectedCount(CM_Month) > 1 or CM_Month='12') and PD='other',SUM(Forecast)+100,SUM(Forecast))

Not applicable
Author

Hello Manish, but this doesn't work if i multi pick like months=10, 11 and 12. This only works when my selection is just for the month=12 only.

rustyfishbones
Master II
Master II

Does the attached help

2014-04-10_1559.png

Anonymous
Not applicable
Author

So, the requirement is probably not

month=12

but

month 12 is in selection.

If yes, this would work:

=If((Center='RO' and PD='other' and index(GetFieldSelections(CM_Month),12)>0),(sum(Forecast)+100),Sum(Forecast))

PrashantSangle

Hi,

Checked enclosed file it is working as per your requirements.

use this expression

=If((Center='RO' and PD='other') and WildMatch(Concat(CM_Month, '@'), '*12*'),(sum(Forecast)+100),Sum(Forecast))

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
MK_QSL
MVP
MVP

IF(GetFieldSelections(Center)='RO' and PD = 'other' and Index(GetFieldSelections(CM_Month),12)>0, SUM(Forecast)+100,SUM(Forecast))