New to QlikView

Discussion board where members can get started with QlikView.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save \$400. Learn More
Highlighted
New Contributor II

IF And Set Analysis

Hello, I'm having some very strange results using Set Analysis and IF

This statement works:

=only({< SIMULATE.Sim_Year = {\$(=(Calendrier.Année))}>}SIMULATE.Sim_Rate)

When try to put an IF around it I'm getting crazy results which I cannot understand

=if(

Currency='Local' ,

only({< SIMULATE.Sim_Year = {\$(=(Calendrier.Année))}>}SIMULATE.Sim_Rate)

,1

)

Any help would be much appreciated Paul

There are two years - I need to get the rate from one of these selected years and apply this rate. The country linked to this SIM table as I sometimes I need the total for all countries (each having it's own rate)

Tags (3)
1 Solution

Accepted Solutions MVP

Re: IF And Set Analysis

This seems to work... part in red was missing

=only({< SIMULATE.Sim_Year = {\$(=(Calendrier.Année))}>} if(Currency='Local' ,SIMULATE.Sim_Rate,1) )

11 Replies
Valued Contributor

Re: IF And Set Analysis

Hello!

Try to get IF-condition into Only() function:

Only({<Set Analysis>} if(condition, true, false))

New Contributor II

Re: IF And Set Analysis

No joy with this I'm afraid

=only({< SIMULATE.Sim_Year = {\$(=(Calendrier.Année)) if(Currency='Local' ,SIMULATE.Sim_Rate,1) ) MVP

Re: IF And Set Analysis

=Only({<SIMULATE.Sim_Year = {\$(=(Calendrier.Année))}, Currency = {'Local'}>}SIMULATE.Sim_Rate)

New Contributor II

Re: IF And Set Analysis

Hi Sunny thanks for your answer. It's not working. I can see  your logic.

What I'm looking for is

Give me a rate (for a year) then if the currency is 'LOCAL' use that rate, else divide by 1.

Hopefully this explains my requirement more.

Thanks,

Paul MVP

Re: IF And Set Analysis

Would you be able to share a sample where you are doing this?

Valued Contributor

Re: IF And Set Analysis

Are you sure that in your case Only() function is returning only one value per year? (SIMULATE.Sim_Rate)

New Contributor II

Re: IF And Set Analysis

The Statement

=only({< SIMULATE.Sim_Year = {\$(=(Calendrier.Année))}>}SIMULATE.Sim_Rate)

works so Yes I'm sure that there is only one year being returned

Adding example to original question MVP

Re: IF And Set Analysis

Why do you think =only({< SIMULATE.Sim_Year = {\$(=(Calendrier.Année))}>}SIMULATE.Sim_Rate) is working? All I see is null value for TEST Column where you seems to be testing this? New Contributor II

Re: IF And Set Analysis

Hi Sandy,

I think that this is working as

When I select  country I get the rate for that year. 