Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
ckoltam
Contributor III
Contributor III

Error in expression: ')' expected

Good evening.

I am trying to create a bar chart with the 12 months of the year as a dimension. What I want is for the chart to always show the 12 months so I need it to ignore the user's selection in the filter panel for the period.

For example: If the user selects the period 08/23/2022, the graph should also show all the months of the year.

For that I need to use this expression:

num(
{<
PERIOD=
>}
$(=(MEASURE)),'$(=ONLY(MEASURE_FORMAT))')

 

PERIOD => date field containing the months. It is my dimension in the graph and it is in the filter panel.

MEASURE_FORMAT => contains the number format.

MEASURE=> this measure contains the type of operation to perform. For example:

SUM(VALUE * RATE_0), SUM(VALUE * RATE_1), SUM(VALUE * RATE_2).

 

I could use MEASURE, but the problem is that the measure has no modifiers set. So I need to add {<PERIOD=>} to ignore the period the user selects.

 

The original expression works correctly on my qlik sense desktop version 14.67.13 (May 2022). The problem is that I need to replicate it on a server with version 13.62.16 (February 2020) and it gives me the error: Error in the expression: ')' expected

 

I really appreciate anyone who can tell me how I can fix it.

I leave the images of the set analysis.

Labels (3)
6 Replies
Vegar
MVP
MVP

I notice that you are adding a set modifier into your NUM(). Could it be that one  that os causing your error? What happens if you remove the {<DESC_PERIOD=>} from your expression.

morgankejerhag
Partner - Creator III
Partner - Creator III

Num can't have set modifiers (only aggregation functions can). If you want to always show all months you can add +sum({1} 0) at the end of the expression. For example sum(SalesAmount)+sum({1} 0)

ckoltam
Contributor III
Contributor III
Author

Thanks for your answer. If I remove the set modifier from the expression it works, but what I need is what I get from

num($(=(EXP_MEASURE_INLINE)),'$(=ONLY(MEASURE_FORMAT))')

 

Plus the condition to exclude any selection made in the period field [DESC_PERIOD] so that the 12 months are always displayed.

ckoltam
Contributor III
Contributor III
Author

Thanks it was helpful. If I use this:

NUM(
$(=(MEASURE)),'$(=ONLY(MEASURE))'
)+SUM({1} 0)

Keeps all months, but doesn't discard the user selection for the values in the graph. If in the [PERIOD] field I select 06/30/2022, it brings me only the values of that month and the rest is shown as zero.

 

I used this other expression to keep the values regardless of the user's selection in the filter panel and it worked:

SUM({1} AGGR({1}

NUM($(=(MEASURE)),'$(=ONLY(MEASURE))')

,PERIOD))

 

About this I had a doubt. Is it possible to add set modifiers and have them work correctly? I tried, but was unsuccessful.

I must filter on the [PERIOD_ID] field the values 1,2,3,4...12. Since they contain the months of the current year. The [PERIOD] field shows more types of dates that I should ignore in the expression and keep the numbers that I mentioned.

This is the expression I tried:

sum({1<PERIOD_ID={1,2,3,4,5,6,7,8,9,10,11,12}>} AGGR({1<PERIOD_ID={1,2,3,4,5,6,7,8,9,10,11,12}>}NUM($(=(MEASURE)),'$(=ONLY(MEASURE))'),PERIOD))

 

Do you know what else I can try?

 

Thanks.

morgankejerhag
Partner - Creator III
Partner - Creator III

Maybe

num($(=(EXP_MEASURE_INLINE))+sum({1} 0),'$(=ONLY(MEASURE_FORMAT_INLINE))')

ckoltam
Contributor III
Contributor III
Author

Thanks but ungratefully this doesn't ignore the user selections on the panel filter. Keeps all the months but if I select one of the values possible on the [period] field the graph shows the eleven rest of the months as zero.

I will keep trying.