Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to give a name for expression in PivotTable?

Label for expression is like

='Current period'&Month

I want to use this expression for calculation later

1 Solution

Accepted Solutions
Not applicable
Author

If you are going to use the same expression in more than one place, and especially if it is a complex expression, then it is a good idea to put the expression text into a document variable. The use the variable name whereever you would use the expression. This not only guarantees that the expression coding is the same in multiple places it also gives you a method for changing the expression in all of those places at once when you change the text in the variable.

View solution in original post

6 Replies
Not applicable
Author

Hi,

Your expression is correct. But If there are more than one values for the Month it will display blank.

To test this make a Listbox for the field Month then select one month; that will be the time that the month will be displayed in label.

You can use this code instead:


='Current Period ' & GetFieldSelections(Month)





Regards,

Nadsky

syed_muzammil
Partner - Creator II
Partner - Creator II

Hi,

Better use Column(Column Number of the Label) function wherever you want to use the label in another expression.

Regards,

Syed.

Not applicable
Author

If you are going to use the same expression in more than one place, and especially if it is a complex expression, then it is a good idea to put the expression text into a document variable. The use the variable name whereever you would use the expression. This not only guarantees that the expression coding is the same in multiple places it also gives you a method for changing the expression in all of those places at once when you change the text in the variable.

Not applicable
Author

Eureka. Thanks you Tim.

At last you've answered a collaboration problem that has been rolling around in my head for some time. How to offer users powerful calculation self-sufficiency without extensive epression training? Most can understand + - / * .

So this sum({$<Year = {$(=max(Year))}, Period = {"<=$(=max({<Year={$(=max(Year))}>} Period))>$(=max({<Year={$(=max(Year))}>} Period)-1)"}>} [Sales Amount])

Become this =CurrentMonthSalesThisYear

And this sum({$<Year = {$(=max(Year))}, Period = {"<=$(=max({<Year={$(=max(Year))}>} Period))"}>} [Sales Amount])

Become this =YTDSalesThisYear

Thanks Again

Rich De Rocco

Not applicable
Author

Hi Tim! I'm a novice in QlikView. I try to make a variable in script like this

set obor=sum(Outcome)/(sum(Salary)/count(DDay))

where Outcome,Salary and DDay are fields.

so, I have PivotTable with expression sum(Outcome)/(sum(Salary)/count(DDay)) (this works) and

expression like =obor - that dont. I try also $(obor) and simply obor - anything works. 😞

Can You help me?

Not applicable
Author

Thats OK with this code - I forget to post ; after set statement, so expression becomes wrong

Thanks Tim!