Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
n1ef5ng1
Creator
Creator

Selection?

Country_DepartureCountry_ArrivalFlightPassengersProfit
IndonesiaSingaporeEugene10112124123
IndonesiaMalaysiaEugene10213122421
IndoensiaIndonesiaEugene103222929292
IndoensiaUSAEugene10194475285632
IndoensiaChinaEugene1041111121

Hi gurus,

I have this pivot table where user can select any country in the world ie, country_arrival

On the above table, there is this pattern where Indonesia --> Country exclude Indoensia 

and

Indoensia to Indonesia

I need two different expression to exprees the value of this two patterns

Therefore, if user select Indonesia, Formula A for Country exclude Indonesia , else Formula B for Indonesia to Indonesia.

7 Replies
luciancotea
Specialist
Specialist

Formula A: =sum( if( only(Country_Departure) <> Country_Arrival and not isnull(only(Country_Departure)) , Passengers)

Formula B: =sum( if( only(Country_Departure) = Country_Arrival, Passengers)

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Are Indonesia and Indoensia different countries? Or just a typing error?

Maybe something like this is what you want:

if(Country_Departure='Indoensia' and Country_Arrival='Indonesia', expression1, expression2)


talk is cheap, supply exceeds demand
n1ef5ng1
Creator
Creator
Author

is there any way I can combine this two formula into one expression?

n1ef5ng1
Creator
Creator
Author

is a typing error.

As my country departure is determine by the user who are able to choose the country

luciancotea
Specialist
Specialist

Yes: =sum( Passengers )

The two expressions exclude each other. One is international flights, the other represent internal flights. Toghether represent all the flights.

Explain what you want to do.

n1ef5ng1
Creator
Creator
Author

Hi Lucian,

Your formula A and B makes sense,

I need the two formula that you express to be in one expression though, not looking for total flights.

is there any if else statemnt that I can use to have formula A and B in one expression

luciancotea
Specialist
Specialist

Yes, you can use:

=if( Flag = 1, FormulaA, FormulaB )

= FormulaA * Flag1 + FormulaB * FlagB

or other combinations. It depends on the context, where you want to include it (Text Object, Chart, ...).

Best provide a sample document which shows the context.