# New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Attend QlikWorld 2020 and hear keynote speaker, Malcolm Gladwell. Register by February 29th to save \$200. Learn More 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.

Tags (3)
1 Solution

Accepted Solutions
Highlighted MVP

## Re: Expression Help

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

8 Replies
Highlighted MVP

## Re: Expression Help

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

Highlighted
Honored Contributor

## Re: Expression Help

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!”
Highlighted
Esteemed Contributor

## Re: Expression Help

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?

Highlighted Not applicable

## Re: Expression Help

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}))

Highlighted
Honored Contributor III

## Re: Expression Help

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.

Highlighted MVP

## Re: Expression Help

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.
Highlighted
Valued Contributor III

## Re: Expression Help

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

Highlighted Not applicable

## Re: Expression Help

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