Skip to main content

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
QlikWorld 2023, a live, in-person thrill ride. Save $300 before February 6: REGISTER NOW!
cancel
Showing results for 
Search instead for 
Did you mean: 
p_quirke_
Contributor II
Contributor II

IF Statement on to be done on a Selected Field

Hello,

I have a requirement to select a year which comes from the front-end and then execute an IF Statement in a chart.

For example when 2018 is selected go and get a particular value or else select 1.

I cannot for the life of me get this working.

This is my year selection:               SIMULATE.Sim_Year = GetFieldSelections(Calendrier.Année)

This is my IF Statement:                 if(Currency ='Local',SIMULATE.Sim_Rate,1)

I need to get the year of the Sim_Rate or the Year of 1.

I've tried various combinations and I cannot seem to get this to work.

SIMULATE.Sim_Year = '($(=GetFieldSelections(Calendrier.Année))', if( Currency ='Local', SIMULATE.Sim_Rate,1)

Any help would be greatly appreciated.

Paul

13 Replies
pradosh_thakur
Master II
Master II

Can you be more clearer

try this

if( Currency ='Local' and getfieldselections(Calendrier.Année)=2018, SIMULATE.Sim_Rate,1)

Learning never stops.
gavinigovind452
Partner - Contributor II
Partner - Contributor II

try this you are  selecting 1 value in SIMULATE.Sim_Year

if(SIMULATE.Sim_Year = '$(=GetFieldSelections(Calendrier.Année))' and Currency ='Local', SIMULATE.Sim_Rate,1)




Regards,

Govind

shraddha_g
Partner - Master III
Partner - Master III

Where do you want to use IF statement?

In set analysis?

p_quirke_
Contributor II
Contributor II
Author

Hi,

Thanks for your answer.

I need to get the value for the SIMULATE.Sim_Rate based on the selected year or else use 1 as the value (this is based on the currency)

Execute this statement

if(Currency ='Local', SIMULATE.Sim_Rate,1) for a year

p_quirke_
Contributor II
Contributor II
Author

Thanks for your answer.

I need to get the value for the SIMULATE.Sim_Rate based on the selected year or else use 1 as the value (this is based on the currency)

Execute this statement

if(Currency ='Local', SIMULATE.Sim_Rate,1) for a year

agigliotti
Partner - Master III
Partner - Master III

could you share  a sample app with mock data ?

gavinigovind452
Partner - Contributor II
Partner - Contributor II

please try it

if(SIMULATE.Sim_Year = '$(=GetFieldSelections(Calendrier.Année))' and Currency ='Local'  and getselectedcount(Calendrier.Année)>=1, SIMULATE.Sim_Rate,1)

p_quirke_
Contributor II
Contributor II
Author

Here is the app - I had to do it in QV - hope this is ok.

agigliotti
Partner - Master III
Partner - Master III

the field name "Currency" does not exists in data model !?