Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how do display all possible dimension after selection

Hi all,

I am working on a chart that present phone brand as dimension and brand share among users as measures.

I want to have the following features

  1. only report brand where at least two users are using it
  2. use GetSelectCount(month_id) to indicate whether there is a selection of month_id
  3. if no month_id is selected, display the latest month data
  4. if one month_id is selected, display the data for selected month (only one month will be selected)
  5. when one brand selection is made, instead of presenting the selection with share 100%, display all other possible brand dimension

for the fourth point, for example. If I select brand Samsung, instead of only presenting Samsung with measure = 100%.

It would be like this.

Samsung     100%

Apple          66%

Reason for the shares above is that all three users in month_id = 1 users Samsung. And two of them also has Apple. Brand Blackberry is not showing because it only has one user.

My expression:

Aggr(

     If(

          Count( DISTINCT

                    {1<user= P({$<month_id = $(=IF(GetSelectedCount(month_id) = 0,'{$(=Max(month_id))}','P({$} month_id)')) >}) >}                          user) > 1,

          brand),

brand)

  

month_iduserbrand
1AApple
1ASamsung
1BSamsung
1BBalckberry
1CSamsung
1CApple

Thanks in advance for the help.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

It would be easier to work on possible solutions if you could upload a small sample QVF.

It's also not 100% clear if you want to count the users per brand (constraint 1.) for the respective month range defined in 2.-4. or across the entire data set.

Hence, it would be good to add some sample selections and expected results.

I've come up with a set expression like

{<

brand = p({<user = p(),brand>}brand)

*

{"=Count(DISTINCT {1<month_id =

$(=IF(GetSelectedCount(month_id) = 0,'{$(=Max(month_id))}','P({$} month_id)'))  >} user) > 1"}

,month_id =

$(=IF(GetSelectedCount(month_id) = 0,'{$(=Max(month_id))}','P({$} month_id)'))

  >}

and used this set expression in all aggregation functions.

Dimension would be just brand.

See attached a sample (left bar chart with suggested solution, right bar chart using the set expression in a calculated dimension, to demonstrate potential differences).

2016-05-19 00_47_51-.png

View solution in original post

2 Replies
swuehl
MVP
MVP

It would be easier to work on possible solutions if you could upload a small sample QVF.

It's also not 100% clear if you want to count the users per brand (constraint 1.) for the respective month range defined in 2.-4. or across the entire data set.

Hence, it would be good to add some sample selections and expected results.

I've come up with a set expression like

{<

brand = p({<user = p(),brand>}brand)

*

{"=Count(DISTINCT {1<month_id =

$(=IF(GetSelectedCount(month_id) = 0,'{$(=Max(month_id))}','P({$} month_id)'))  >} user) > 1"}

,month_id =

$(=IF(GetSelectedCount(month_id) = 0,'{$(=Max(month_id))}','P({$} month_id)'))

  >}

and used this set expression in all aggregation functions.

Dimension would be just brand.

See attached a sample (left bar chart with suggested solution, right bar chart using the set expression in a calculated dimension, to demonstrate potential differences).

2016-05-19 00_47_51-.png

Not applicable
Author

Hey

Thanks again.

This is very helpful