Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Help with expression formulae please...

Hi,

I'm struggling with an expression formula. Heres what i want to do...

I have a chart. The dimension is called DispositionGroupName. My expression is a simple distinct count of EpisodeId. Here's where the fun starts....There are multiple Levels to Disposition Groups identified by the DispositionGroupLevelId (a hierachy). So i use set analysis in my expression to ensure i'm looking at only DispositionGroupLevelId = 4 by default.

Count({$<DispositionGroupLevelId={4},DispositionGroupOpenTreeView=>} distinct EpisodeId)

Users can select a Disposition group by using the treeview i created; DispositionGroupOpenTreeView. What i want to do is say.... If theres NO selection on 'DispositionGroupOpenTreeView' then use DispositionGroupLevelId = 4. Else... If there is a selection on DispositionGroupOpenTreeView, use the corresponding DispositionGroupLevelId in the expression.

I started trying to put it together, but realised because the user isnt making a selection directly on DispositionGroupLevelId, then i can't use 'GetFieldSelections'

=If(GetSelectedCount(DispositionGroupOpenTreeView) <> 1,

          Count({$<DispositionGroupLevelId={4},DispositionGroupOpenTreeView=>} distinct EpisodeId),

          Count({$<DispositionGroupLevelId = {"$(=GetFieldSelections(DispositionGroupLevelId))"}} DISTINCT EpisodeId))

HELP!

Thanks.

- Mathew.

1 Solution

Accepted Solutions
Not applicable
Author

SOLVED!

So i couldnt get to the answer yesterday, but walked in this morning with a clear head and solved it in 2 minutes.

Very simple really... just look for the max DispositionGroupLevelId based on whatever is selected.

=If(GetSelectedCount(DispositionGroupOpenTreeView) <> 1,

          Count({$<DispositionGroupLevelId={4},DispositionGroupOpenTreeView=>} distinct EpisodeId),

          Count({$<DispositionGroupLevelId = {"$(=Max(DispositionGroupLevelId))"},DispositionGroupOpenTreeView=>} DISTINCT EpisodeId))

View solution in original post

1 Reply
Not applicable
Author

SOLVED!

So i couldnt get to the answer yesterday, but walked in this morning with a clear head and solved it in 2 minutes.

Very simple really... just look for the max DispositionGroupLevelId based on whatever is selected.

=If(GetSelectedCount(DispositionGroupOpenTreeView) <> 1,

          Count({$<DispositionGroupLevelId={4},DispositionGroupOpenTreeView=>} distinct EpisodeId),

          Count({$<DispositionGroupLevelId = {"$(=Max(DispositionGroupLevelId))"},DispositionGroupOpenTreeView=>} DISTINCT EpisodeId))