Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
onetwothree123
Partner - Contributor III
Partner - Contributor III

How to make an Expression Dynamic.

Currently I am using the following expression in a bar chart,

SUM ( { < Flag ={ 'Y' } > } Mon1) .

Where mon1 refers to first month(Jan).

I want to make it dyanmic so if I make a selection in month list box, it should dislpay corresponding values in Bar chart

(say I make mon4 as selection, bar chart should display data for April(Mon4)  and so on)

7 Replies
swuehl
MVP
MVP

Not sure if I understood your data model correctly, and it may be mucg different than I assume so you may need to detail your data model a bit more, but maybe you could just replace your Mon1 by the not aggregated value field:

=sum({<Flag = {'Y'}>} Value)

and maybe use Month field name as dimension to group by your selected month.

jagan
Luminary Alumni
Luminary Alumni

Hi,

If there is a proper mapping between the tables, then qlikview automatically filters the data based on the selected filters.  The charts automatically refreshes if the selection changes.

Regards,

Jagan.

tresesco
MVP
MVP

Hi,

you have to remove the month field from the expression, then it would behave as per selection.

Regards,  tresesco

onetwothree123
Partner - Contributor III
Partner - Contributor III
Author

swuehl,

I have 12 different columns in a table mon1 mon2 and so on.

My current expression is hard coded just for mon1(Jan).

So I am looking for a logic to put  in expression, where I don't have to hard code it mon1 ,mon2 ....... for all 12 months

swuehl
MVP
MVP

So you actually don't have a field Month you can select from?

Maybe you want to use a crosstable load to transform your current table into a straight table, using something like

Crosstable (Month, Data) Load Flag, Mon1, Mon2, ...

from Table;

If you want to use a crosstable load , please check the Manual. You can also use the table wizard to transform your input table.

Hope this helps,

Stefan

onetwothree123
Partner - Contributor III
Partner - Contributor III
Author

Stefan,

I have 12 different fields to select from.

Mon1

.

.

.

....Mon12

Not applicable

What stefan is saying is that you should modify your load script in order to transform your 12 fields into 1 with a corss table.

Finally you'll get a month field which you can use in your expression.

Moreover, in your bar chart you can use this month as dimension instead of  i believe that now you have 12 expressions.