Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Experts,
I'm working on a KPI but the problem is that I wanted to be flexible that the user can click on a selection and the dimension of all the charts will be replaced by the dimensions corresponding to the user's selection.
I'm using a 'Variable Input' object to store the selection of the user into a Variable.
Then, the variable will be my condition in an if-else statement inside the Dimensions Fx.
Here's a sample of that expression:
=If(vDimensionSelection = 'Books', BookNames,
if(vDimensionSelection = 'Cars', CarBrands,
if(vDimensionSelection = 'Fruits', FruitNames,
if(vDimensionSelection = 'Country', CountryNames))))
Thank you in advance!
use Pick & WildMatch instead
=Pick(WildMatch(vDimensionSelection , 'Books', 'Cars', 'Fruits', 'Country'),BookNames,CarBrands,FruitNames,CountryNames)
Hi vinieme12,
I've tried using Pick & WildMatch but the result is still blank.
I don't know why it cannot read the fieldnames based on the variable selected on the dimension.
Thanks.
let me understand this
vDimensionSelection = getfieldselections(DimensionName)
vSelectedDimension
=Pick(WildMatch('$(vDimensionSelection)', 'Books', 'Cars', 'Fruits', 'Country'),BookNames,CarBrands,FruitNames,CountryNames)
in chart Dimension =
$(vSelectedDimension )
Hi Vinieme,
Does this line accepts multiple dimensions?
vDimensionSelection = getfieldselections(DimensionName)
My issue that the user can select a value from a "Variable Input" and based on the value,
The dimension of the chart will change...
If I will translate your Pick&Match to what I need it'll be like this:
=Pick(WildMatch('$(vDimensionSelection)', 'Variable Input 1', 'Variable Input 2', 'Variable Input 3', 'Variable Input 4'),Dimension 1,Dimension 2,Dimension 3,Dimension 3)
But I've tried this approach and didn't worked. ;(
I believe you are almost there. Try using this pick-match.
vSelectedDimension= Pick(Match('$(vDimensionSelection)', 'Books', 'Cars', 'Fruits', 'Country'), 'BookNames','CarBrands', 'FruitNames', 'CountryNames')
And then this dimension expression:
[$(vSelectedDimension)]
I'd also suggest you go thru this blog
https://community.qlik.com/t5/Qlik-Design-Blog/Customizable-Straight-Table/ba-p/1464825
For you this should like below
=Pick(WildMatch('$(vDimensionSelection)'
, chr(39)&variable1&chr(39)
, chr(39)&variable2&chr(39)
, chr(39)&variable3&chr(39)
, chr(39)&variable4&chr(39)
),Dimension1,Dimension2,Dimension3,Dimension4)
Hi Experts,
I think I understand how you wanted it to be executed.
I'm almost there. However, what I don't understand is how I will put that into translation.
I'm using a "Variable Input" object and as you can see in the image below, I'm capturing the value selected by the user to a variable vDimensionSelection.
I think this is where I'm having trouble.
This is even simpler
You don't need any intermediate variables
Just use the Value~Label notations
Use below as dynamic value
'BookName~Books|CarBrand~Cars|FruitNames~Fruits|CountryName~Country'
in chart just use $(vDimensionSelection)