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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
retko1985
Creator II
Creator II

If Only (....) = Only (....), something, null() - gives null for total.

Hello,

the heading might be confusing, apologies here. There is a problem I am facing (see also attached QVW):

I am using expression like this in my straight table:

=if(Only(Country) = vAlternativeCountry,

Sum(Sales), null())

variable vAlternativeCountry contains: =Only({<City=$::City>}Country)

Also straight table is in Alternate state A.

The problem is that I get null for total.

I tried to use dimensionality () <> 0, but couldn't make it work.

Can someone help me to get the total there?

[Basically the table will show all cities of the country, when I select one city.]

[I kinda don't want to use p in set analysis]

Thank you for any help.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Try this as expression

Sum({<Country = p({$}), City>}Sales)

View solution in original post

2 Replies
swuehl
MVP
MVP

Try this as expression

Sum({<Country = p({$}), City>}Sales)

Frank_Hartmann
Master II
Master II

sum(aggr(if( Only( Country) = vAlternativeCountry,Sum( Sales), null()),City))