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

Help is writing an expression

I need help with the following use case

List all values of a dimension which coexist the most with the current selection in the same dimension.

If a box can hold multiple color balls, for example if I select green, I want to list the colors that exist the most where color is green

The sql is something like this:

SELECT color, COUNT(*) FROM table

WHERE id in

(select id  from table where color is selectedcolor)

and color is not null

and color <> selectedcolor

group by color

order by 2 desc

5 Replies
rvijayanth
Creator
Creator
Author

Is this request clear?

ahaahaaha
Partner - Master
Partner - Master

Hi,

May be data fragment and expected result?

tajmohamed30
Creator III
Creator III

hi,


whether you looking like this


=Sum(Aggr( If(Rank(Count(colors)) =1, Sum(colors)),  id, color))

rvijayanth
Creator
Creator
Author

Lets say I have a column dept_id and possible "color"s in a second column. There will be more than one color for each dept_id.

Now I want to display two filters (both showing dimension "color"). the first one shall simply be "Color" but the second shall ONLY show "Color" which exist with the color that was selected in the first filter.

So if someone selects a different color in the second filter, the dept_id which contains both colors alone should show up.

Simply put: i want users to select two values from a dimension BUT instead of an OR logic, I want an AND logic between two selected values.

rvijayanth
Creator
Creator
Author

Lets say I have a column dept_id and possible "color"s in a second column. There will be more than one color for each dept_id.

Now I want to display two filters (both showing dimension "color"). the first one shall simply be "Color" but the second shall ONLY show "Color" which exist with the color that was selected in the first filter.

So if someone selects a different color in the second filter, the dept_id which contains both colors alone should show up.

Simply put: i want users to select two values from a dimension BUT instead of an OR logic, I want an AND logic between two selected values.