Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Background Color based on multiple fields or specific text

Hi Qliksperts!

I am trying to build a number of charts from which a storemanager can click on store X in chart 1 and then this store will be highlighted in all the other charts. This is working just fine with the background colour expression below:

=if(wildmatch(GetFieldSelections([StoreName]),'*'&only({1}[StoreName]) ) ,rgb(100,255,100))

However, some of the storenames are very similar (' XXX Webshop' and 'Webshop' as an example), and so several stores are highlighted because of the wildmatch search. Can i alter the expression above to search for the exact same text, hence not highlighting 'Webshop' when 'XXX Webshop' is being clicked on?

An alternative could be to make something like the below expression although i know the syntax wont work.. The StoreNumber is not unique (although it really ought to be) so i can't just use that.

=if(wildmatch(GetFieldSelections([StoreName]),'*'&only({1}[StoreName]) )

AND

wildmatch(GetFieldSelections([StoreNumber]),'*'&only({1}[StoreNumber]) )

,rgb(100,255,100))

Any good suggestions out there?

THANKS A LOT!

1 Solution

Accepted Solutions
Not applicable
Author

Thats the trick - dont actually know how i ended up with that expression in the first case. Simply by removing the only() i got the desired result... Not quiiite sure what/how/why but i'm a happy camper now

=if(wildmatch(GetFieldSelections([StoreName]),

//'*'&only({1}

[StoreName])

//)

,rgb(xxx,xxx,xxx))

Thx.

View solution in original post

6 Replies
lironbaram
Partner - Master III
Partner - Master III

you can use match instead of wildmatch

sunny_talwar

how is only working for you??? If StoreName has multiple rows of data, I would expect it to give null ( - ). When you put this in a text box object -> Only({1}StoreName) do you see value getting populated???

Not applicable
Author

Yeah, i usually don't forget important details but i can see i forgot one thing:

My Dimension is not just [StoreName], it is: StoreNumber & '-' & StoreName, so i really don't know the syntax for using the match function on this calculated dimension, so thats why i just went with the wildmatch, but now its an issue.

Thx

Gysbert_Wassenaar

Try =if(getselectedcount(StoreName) and max(match(StoreName,StoreName)),rgb(100,255,100))


talk is cheap, supply exceeds demand
lironbaram
Partner - Master III
Partner - Master III

hi

look at the attach file

Not applicable
Author

Thats the trick - dont actually know how i ended up with that expression in the first case. Simply by removing the only() i got the desired result... Not quiiite sure what/how/why but i'm a happy camper now

=if(wildmatch(GetFieldSelections([StoreName]),

//'*'&only({1}

[StoreName])

//)

,rgb(xxx,xxx,xxx))

Thx.