Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Not applicable

Need to change Expression dynamically based on a value in the dimension(not selection)

Hi Everyone,

I actually have a very basic issue. I have a chart in which I am using 2 fields i.e Time (Monthly,YTD) and KPI (Sales, Target), coming from isolated Inline Tables as dimensions for labeling purpose only. As shown in the table below. Based on the Values of these fields, I need to changes the Expression Label.

MonthlyMonthlyMonthlyMonthlyYTDYTDYTDYTD
SalesSalesTargetTargetSalesSalesTargetTarget
2012122013122012122013122012201320122013
4545

5656

5666767666767676676

So, I am keeping only one expression and using 'If else' statement, putting 4 logic inside it. However I am not able to achieve the same thing for Labels.

If you see the above table for YTD, labels are only years i.e. 2012 & 2013.

Would appreciate the help and suggestions.

Thanks,

Neelam

Tags (1)
9 Replies
whiteline
Honored Contributor II

Re: Need to change Expression dynamically based on a value in the dimension(not selection)

Hi.

Could you describe what you're trying to achieve ?

sujeetsingh
Honored Contributor III

Re: Need to change Expression dynamically based on a value in the dimension(not selection)

Use the same logic to describe the label too.

Not applicable

Re: Need to change Expression dynamically based on a value in the dimension(not selection)

Hi,

Please refer to the table which I have drawn below. So for monthly the captions are perfectly fine. But if you see YTD, the Captions should be 2011, 2012 i.e only Year.

I  have 3 expressions in this chart in which I am putting If Else logic using two fields Time(First row) and KPI(Second Row) to get the respective formula.

These 2 fields are actually coming from isolated inline tables.

I tried using the same If Else logic to get the values in Captions also, but its working in the captions(Strange)

Untitled.jpgI hope it helps.

Thanks

Neelam

Not applicable

Re: Need to change Expression dynamically based on a value in the dimension(not selection)

Hi,

Unfortunately, the same logic is not working in Captions

Thanks,

Neelam

MVP
MVP

Re: Need to change Expression dynamically based on a value in the dimension(not selection)

Neelam,

Try to share a sample qvw here with small dummy data.

Not applicable

Re: Re: Need to change Expression dynamically based on a value in the dimension(not selection)

Hi Tresesco,

How are you? Long time!! Please ping your number over FB, will call you sometime.

PFA the sample QV file.

Thanks,

Neelam

MVP
MVP

Re: Re: Re: Need to change Expression dynamically based on a value in the dimension(not selection)

Hi,

I suppose, the label is expected to be one for an expression (which is fair). When you pull that expression to column in a pivot chart it appears to be mutiple columns while the internal representation is same - an expression. So, it doesn't actually take the dimension values into consideration in this label expression; hence it doesn't recognize them. I have tried an alternative (in the script), see if this helps. PFA.

Not applicable

Re: Need to change Expression dynamically based on a value in the dimension(not selection)

Hi Tresesco,

Thanks for the suggestion, however it wont work in my scenario as the values will keep changing based on the selection. May be an alternate solution would be to create several columns which may not look visually good.

Thanks,

Neelam

MVP
MVP

Re: Need to change Expression dynamically based on a value in the dimension(not selection)

Hi,

I guess, with proper structuring of _Time, _Metric2 and Exp fields in the script could take you to goal. And that would respond to your selection dynamically as well. But that's again tweaking your entire model.

Community Browser