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

Expression Help

=If(GetSelectedCount(LuCurrencyType3) > 0 and [Year of Expense]=2016,

 

(sum([Expense]*Factors)/([Factors3])),

  (sum([ Expense]*(Factors))))

Is there anything wrong in the above expression ?

Thank you.

1 Solution

Accepted Solutions
sunny_talwar

May be reduce the excessive use of parenthesis to see if you have extra parenthesis in there:

=If(GetSelectedCount(LuCurrencyType3) > 0 and [Year of Expense]=2016,

(sum(Expense*Factors)/[Factors3]),(sum(Expense*Factors)))

View solution in original post

8 Replies
sunny_talwar

May be reduce the excessive use of parenthesis to see if you have extra parenthesis in there:

=If(GetSelectedCount(LuCurrencyType3) > 0 and [Year of Expense]=2016,

(sum(Expense*Factors)/[Factors3]),(sum(Expense*Factors)))

HirisH_V7
Master
Master

Hi,

Check with this Expression,

If(GetSelectedCount(LuCurrencyType3) > 0 ,

(sum({<[Year of Expense]={'2016'}>}[Expense])*Sum({<[Year of Expense]={'2016'}>}Factors))/Sum({<[Year of Expense]={'2016'}>}[Factors3]),

  (sum({<[Year of Expense]={'2016'}>}[Expense])*Sum({<[Year of Expense]={'2016'}>}Factors))

Hope this Helps,

Hirish

HirisH
“Aspire to Inspire before we Expire!”
Anonymous
Not applicable
Author

may be this?

=If(GetSelectedCount(LuCurrencyType3) > 0 and [Year of Expense]=2016,

sum([Expense]*Factors)/[Factors3], sum([ Expense]*Factors))

What issue you are facing??

Are you getting any error as expression looks okay?

Not applicable
Author

Hi Pavana please try this expression.

if(GetSelectedCount(LuCurrencyType)>0 and [Year Of Expense]=2016,

(Sum({$<[Year Of Expense]={'2016'}>Expense})*Sum({$<[Year Of Expense]={'2016'}>Factors}))/Sum({$<[Year Of Expense]={'2016'}>Factors3}),

(Sum({$<[Year Of Expense]={'2016'}>Expense})*Sum({$<[Year Of Expense]={'2016'}>Factors}))

Digvijay_Singh

It appears you have kept Factors3 out of aggregation functions, which needs to be validated through sample data. Check if it should be inside sum or not.

PrashantSangle

Hi,

did you get any error??

Syntax wise, it is correct.

might be issue because of naked expression for Factors3..

Try below,

If(GetSelectedCount(LuCurrencyType3) > 0 and [Year of Expense]=2016,

(sum([Expense]*Factors)/sum([Factors3])),

  (sum([ Expense]*(Factors))))

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 🙂
engishfaque
Specialist III
Specialist III

Dear Pavana,

Here is an expression,

Expression 1:

----

=If(GetSelectedCount(LuCurrencyType3) > 0 and [Year of Expense] = 2016,

  ([Expense]*Factors)/[Factors3],

  [Expense]*Factors

  )

Expression 2:

----

=If(GetSelectedCount(Len(Trim(LuCurrencyType3))) > 0 and [Year of Expense] = 2016,

  ([Expense]*Factors)/[Factors3],

  [Expense]*Factors

  )

Kind regards,

Ishfaque Ahmed

Not applicable
Author

=If(GetSelectedCount(LuCurrencyType3) > 0 ,

  sum([Expense]*Factors)/[Factors3],

   sum([Expense]*Factors))

The above expression works fine and give me the amount for all the year,where as I want to filter for current year and when I add the Year filter still it shows the amount for all the years.

If(GetSelectedCount(LuCurrencyType3) > 0 and [Year of Expense]=2016 ,

  sum([Expense]*Factors)/[Factors3],

   sum([Expense]*Factors))

If I filter year from list box it will show amount for current year,but I want to do that in expression itself.

None of the above expression is working.Not sure why.Thank to you all though.