Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
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))