Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

User variable in a dimension

Hi

Got a question how to use a user variable in a dimension.

I have this dimension definition:

=if(Geography_CountryCode='IT' and Supplier <> 'A' and Supplier <> 'B','Italy')

No i want this part - and Supplier <> 'A' and Supplier <> 'B - to be replaced by a user variable, because i need this formula many places and there might be a C and a D as well

How can i do that?

something like

=if(Geography_CountryCode='IT' and $uvSupplier,'Italy')

doesnt work (of course)

Anyone that can direct me the the right direction?

1 Solution

Accepted Solutions
jagan
Partner - Champion III
Partner - Champion III

Hi Flemming,

Try like this

NOT WildMatch(Supplier, $(vSuppliers))


Regards,

Jagan.

View solution in original post

8 Replies
robert99
Specialist III
Specialist III

Do you want users to select suppliers they do not want. So they would  select suppliers they do not want in an input box for example

Not applicable
Author

No in the first part, I would like to maintain the number of suppliers that should not be included in the dimension as a variable - not editable by users

robert99
Specialist III
Specialist III

Unsure if this can be done

But if you put the details in an expression and exclude zero it could be done

count({<Call_Supp_Num =- {$(vSupp)}>}Supplier)

with variable set up as vSupp = A,B,C

This would exclude supplier A,B and C and D also if you add to the variable

If you also want D just add as required

But I,m unsure if this is what you want or not.

agilos_mla
Partner - Creator III
Partner - Creator III

Hi,

you might refer to dollar sign expansion to buid a parametrizable calculated dimensions.

Dollar-Sign Expansion with Parameters
Parameters can be used in variable expansions. The variable must then contain formal parameters, such as $1, $2, $3 etc. When expanding the variable, the parameters should be stated in a comma separated list.

Examples:
set MUL=’$1*$2’;

set X=$(MUL(3,7)); // returns ‘3*7′ in X

let X=$(MUL(3,7)); // returns 21 in X

jagan
Partner - Champion III
Partner - Champion III

Hi Flemming,

Try like this

=if(Geography_CountryCode='IT' and WildMatch(Supplier, $(vSuppliers)),'Italy')


where vSuppliers = 'A', 'B'


Hope this helps you,.


Regards,

Jagan.

Not applicable
Author

Hi Jagan

This is nice, thanks.

How if I want to exclude the list of suppliers, so the wildmatch argument should be <> and not =

Regards

Flemming

jagan
Partner - Champion III
Partner - Champion III

Hi Flemming,

Try like this

NOT WildMatch(Supplier, $(vSuppliers))


Regards,

Jagan.

Not applicable
Author

You are a genious...:-)

Thanks a lot - exactly what i needed....


Flemming