Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Groups in expressions

I am using the group-option in the expression window, these groups don't have a name. Is it possible to use the function getcurrentfield() with these groups?? I have two columns, i would like to have one cycle (group) column, the 2e column i would like to display a expression based on the active expression from column(1). would this be possible??

3 Replies
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

As far as I know, the function getcurrentfield() only works with Dimension groups, and I'm not aware of any other functions (unfortunately!) that could give you a handle on the current Expression selected from a group...

As an idea - you could have another "dummy" expression that would hold the current choice (you'll need to hide it, unless it's a Pivot Table), and then condition your other two expressions on the value of the first. Something like this:

Expression 1 (hidden): a Group of 3 Expressions:

Gross Sales = 1 (constant value)

Gross Margin = 2

Net Profit = 3

Expression 2:

If(Column(1) = 1, sum(Sales),

if(Column(1) = 2, (sum(Sales) - Sum(Cost))/Sum(Sales,

if(Column(1) = 3, ..... etc .... )))

Expression 3:

IF( Column(1)=1,

... well, you get the idea...

I've never tried it before but I think it could work...

good luck!

Not applicable
Author

Nice approach, but how would expression 1 (hidden) know which constant value to display, based upon the cyclic group?? Besides it's a pivot table i'm working with.........

wizardo
Creator III
Creator III

you could skip the hidden field entirely and use a variable and put a smal inputbox above the table so the user can switch.

or if you want even more dynamics you can create an island table with fields: "expressions" and "ID"

then you make a listBox with the option "only one selected" and you use the $ expension with getfieldselections () function inside and you have a dynamic group of expressions