Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I have a Filter (COUNTRY) where i can select USA, Canada, Mexico e.g.
In an expression of combo chart, if i have selected USA or USA and Canada or USA and Mexico or USA , Mexico and Canada, or anything i have to use Expression A otherwise Expression B using (IF)
I Create this:
if(
wildmatch(concat(COUNTRY,''),'*USA*'),
sum(X),
sum(Y)
)
but works only if I do not select anything (sum X) or if not select USA (sum Y).
When i select USA use sum Y.
If i insert this expression on a label works perfectly.
I have tried also substringcount(concat(COUNTRY),'USA')=1 but don't works.
Any Idea?
Thanks and Regads,
Demetrio
Resolved
I have created a variable: =substringcount(concat(F_ECONOMICS_NAFTA.COUNTRY_FILTER),'USA') and inserted this on expression (>0)
Unless variable the chart don't works fine but with this it's ok!
May be try this
SubStringCount(Concat(DISTINCT COUNTRY), 'USA') >= 1
Or this
If(WildMatch(Concat(DISTINCT COUNTRY,''),'*USA*'), Sum(X), Sum(Y))
Hi Sunny,
don't works.
The problem it's that in the chart the first condition is false when USA is selected ....in the text object not....and works...
Would you be able to share a sample to show the issue?
and if use getfieldselection(country) and select only USA works ...
Hi Sunny,
in attachment a example.
The goal is that if USA is selected (or anything) we have sum(x) otherywise sum(y).
In example sum(X) 100 for all country
thanks
Demetrio
May be this
=If(WildMatch(GetFieldSelections(Country), '*USA*'), Sum({<Country>}X), Sum({<Country>}Y))
When USA is selected
When USA is not selected
When Multiple things are selected
Hey Sunny,
don't works yet but i don't wrote all .
In the filter i have others 3 country that have to see only on chart (not selectable on filter) when USA is selected.
For this on the script i have duplicate field country, named country_filter that write null for this country and used on filter.
That expression used it's :
if(
wildmatch(GetFieldSelections(F_ECONOMICS_NAFTA.COUNTRY),'*USA*'),
// EXPRESSION A
sum({<F_ECONOMICS_NAFTA.COUNTRY_FILTER=,
F_ECONOMICS_NAFTA.COUNTRY={$(=v_country_exchange_rate_NAFTA2),$(=v_country_exchange_rate_NAFTA)},
F_ECONOMICS_NAFTA.DATA ={">=$(=DATE#((v_selected_period5)&'-01'))<=$(=DATE#((v_selected_period6)&'-01'))"}>}
F_ECONOMICS_NAFTA.AVERAGE_RATE_FF_MONTHLY),
// EXPRESSION B
sum({<F_ECONOMICS_NAFTA.DATA ={">=$(=DATE#((v_selected_period5)&'-01'))<=$(=DATE#((v_selected_period6)&'-01'))"}>}
F_ECONOMICS_NAFTA.AVERAGE_RATE_FF_MONTHLY)
)
____________
where
v_country_exchange_rate_NAFTA2
=chr(39)&Concat(F_ECONOMICS_NAFTA.COUNTRY_FILTER,chr(39)&','&chr(39))&chr(39)
v_country_exchange_rate_NAFTA = 'Euro Area','Japan','UK'
______________
This don't works only when USA is select
Where i have to modify it?
May be try this
If(WildMatch(GetFieldSelections(F_ECONOMICS_NAFTA.COUNTRY), '*USA*'),
// EXPRESSION A
Sum({<F_ECONOMICS_NAFTA.COUNTRY_FILTER, F_ECONOMICS_NAFTA.COUNTRY =P(F_ECONOMICS_NAFTA.COUNTRY_FILTER) + {$(v_country_exchange_rate_NAFTA)},
F_ECONOMICS_NAFTA.DATA = {">=$(=Date#((v_selected_period5) & '-01'))<=$(=Date#((v_selected_period6) & '-01'))"}>} F_ECONOMICS_NAFTA.AVERAGE_RATE_FF_MONTHLY),
// EXPRESSION B
Sum({<F_ECONOMICS_NAFTA.DATA = {">=$(=Date#((v_selected_period5) & '-01'))<=$(=Date#((v_selected_period6) & '-01'))"}>} F_ECONOMICS_NAFTA.AVERAGE_RATE_FF_MONTHLY))