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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Expression based on dimension?

Hey,

I have a time dimension and an expression based on a growth variable (e.g. 10% growth per month). If the user zooms in to weekly, daily or lower levels the formula won't work because the corresponding growth rate refers to month number.

Is it possible to use an if statement to define the variable dynamically based on the dimension? E.g. different expression for, month, week, and so on?

Kr.

Daniel

1 Solution

Accepted Solutions
swuehl
MVP
MVP

I assume you are using a group with your dimension, right?

Then try using system function GetCurrentField() in your if() statement's condition:

GetCurrentField(groupname)

returns the name of the field currently active in the group named groupname.

Example:

getcurrentfield( MyGroup )

View solution in original post

5 Replies
swuehl
MVP
MVP

I assume you are using a group with your dimension, right?

Then try using system function GetCurrentField() in your if() statement's condition:

GetCurrentField(groupname)

returns the name of the field currently active in the group named groupname.

Example:

getcurrentfield( MyGroup )

Not applicable
Author

No just regular time dimensions: year, month, week and so on. Qlikview automatically allows users to drill down, you don't need to group time dimensions.

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Something like this maybe:

if( getpossiblecount(day) = 1, dayexpression,

   if( getpossiblecount(week) = 1, weekexpression,

      if( getpossiblecount(month) = 1, montexpression, yearexpression )))


talk is cheap, supply exceeds demand
swuehl
MVP
MVP

If you are using multiple dimensions like year, month, date without a dimension group, I believe you are not drilling down, just selecting some dimension values, aren't you? I mean, the granularity is not changing, because whatever you select, your expression is always evaluated in the smallest granularity of dimensions year, month, date (i.e. date), right?

I am probably missing something essential here, could you post a small sample app?

Not applicable
Author

Swuehl, let's just say it's friday.. Indeed I created a group a long time ago.. which allows drill down functionality. Apart from the drilldown group I also have several listboxes where users can indeed select.

The if statement solution should work. Thanks a lot!