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

Different Expressions Between Cyclic Group Selections

I have a report with a bar chart that is showing the run time of jobs for a server. I have a cyclic group that can change between Day of the month, month, year, and day of week. If I select "Day" under the cyclic group, a specific year, and month, I can se my specific run time for that day, but if I change the cyclic to month, it gives me total hours of runtime for that job for the entire month. I need the average time it took to run for the month. When on day of the week, I need to see average runtime for that day of the week and ect...

Any ideas on how to do this using a cyclic group without making separate charts for Day, Month, Year, and Day of Week? I need a different expression bases on what is selected in the cyclic group.

I have attached an example of my report for reference.

1 Solution

Accepted Solutions
Anonymous
Not applicable

You can use GetCurrentField([Date Group]) in the conditional box of the expression, then make different expressions based on the value of the cycle group.

Ex. Expression 1: set the Conditional box as GetCurrentField([Date Group]) = 'Year'

      Expression 2: set the Conditional box as GetCurrentField([Date Group]) = 'Month'

...and so on. Then expression 1 will only be calculated if your cycle group is on year, expression 2 will only be calculated if the cycle group is on month, etc. Just make sure that all possible options of your cycle group are included in the conditional expression or you will get the error "all expressions are disabled".

View solution in original post

3 Replies
Anonymous
Not applicable

You can use GetCurrentField([Date Group]) in the conditional box of the expression, then make different expressions based on the value of the cycle group.

Ex. Expression 1: set the Conditional box as GetCurrentField([Date Group]) = 'Year'

      Expression 2: set the Conditional box as GetCurrentField([Date Group]) = 'Month'

...and so on. Then expression 1 will only be calculated if your cycle group is on year, expression 2 will only be calculated if the cycle group is on month, etc. Just make sure that all possible options of your cycle group are included in the conditional expression or you will get the error "all expressions are disabled".

Anonymous
Not applicable

I'd rather avoid downloading 18+ MB file, so I'll try to explain.

You can use function GetCurrentField() - it returns the name of the current field in cycle. So, something like that:

pick(match(GetCurrentField(YourCyclicGroupName),'Day','Month','Year','Week'), <expression for Day>,<expression for Month>,<expression for Year>,<expression for Week>)

MalcolmCICWF
Creator III
Creator III
Author

Awesome, Thanks! I did not know about the GetCurrentField function for groups. Very useful