Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Not applicable

Error - Expected ')'

Hello,

I'm struggling to identify where the error is occurring in the following expression:

=Month(max(Date)) & ' vs ' & Month(max(Date)-31) & chr(10) & 'Spending' & chr(10) &

num(fabs($(vMonthSpending) - $(vLastMonthSpending) / $(vMonthSpending)), '(##.00%)')

I'm trying to get a text output of a selected month vs. last month's spending increases as a percentage.

Here is the expression for the Year vs. Last Year spending increase that executes successfully:

=max(Year) & ' vs ' & (max(Year)-1) & chr(10) & 'Spending' & chr(10) &

num(fabs($(v2017Spending) - $(v2016Spending) / $(v2017Spending)), '(##.00%)')

Any advice or assistance is much appreciated.

Best,

AR

19 Replies
vishsaggi
Esteemed Contributor III

Re: Error - Expected ')'

Where are you getting this error? in Text box or while reloading? Can you share a snapshot?

atkinsow
Valued Contributor II

Re: Error - Expected ')'

Yours looked fine but you could try...................


=Month(max(Date)) & ' vs ' & Month(AddMonths(Monthstart(max(Date)),-1)) & chr(10) & 'Spending' & chr(10) &
num(fabs($(vMonthSpending) - $(vLastMonthSpending) / $(vMonthSpending)), '(##.00%)')

Highlighted
Not applicable

Re: Error - Expected ')'

on the last part try removing the quotes, and putting the % at the end with & '%'

Not applicable

Re: Error - Expected ')'

Hey Wallo,

Just gave this a try and I'm still getting the same error readout. Thanks for the suggestion, but I'm still not sure what the issue is.

atkinsow
Valued Contributor II

Re: Error - Expected ')'

Can you share a sample app?

atkinsow
Valued Contributor II

Re: Error - Expected ')'

You could try

=Month(max(Date)) & ' vs ' & Month(AddMonths(Monthstart(max(Date)),-1)) & chr(10) & 'Spending' & chr(10) & '(' &
num(fabs($(vMonthSpending) - $(vLastMonthSpending) / $(vMonthSpending)), '##.00%') & ')'

jwbadger3
New Contributor II

Re: Error - Expected ')'

Also try checking your variable expressions. It's possible you're missing something in one of them and the error is occurring during the dollar sign expansion on execution of the expression.

Not applicable

Re: Error - Expected ')'

Here is the variable script:

vLastMonthSpending:

=count({<Month = {$(=max(Month)-31)}>} distinct Amount)

vMonthSpending:

=count({<Month = {$(=max(Month)-31)}>} distinct Amount)

vishsaggi
Esteemed Contributor III

Re: Error - Expected ')'

When you check your variables are they holding any data? Use Ctrl+Alt+V and see what values you can see for these variables? Can you share a sample if possible that has this issue?