Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

priyarane
Contributor III

HardCode Value

Hi Community,

I have table like below. And requirement is if Dim=C then I need sum(Val1) and I have writtern expression like below but problem is if I select any Dim value then it is disappearing but as per my requirement it shouldn't be disappear. so If I select A then C value is 100 and for B 200 and for C 300.

LOAD * INLINE [
Dim, Val, Val1
A, 10, 100
B, 20, 200
C
]
;

if(Dim = 'C',
$(=sum(Val1)),
sum(Val)
)

-Priya

1 Solution

Accepted Solutions
balar025
Contributor III

Re: HardCode Value

Please find new app for solution.

15 Replies
zhadrakas
Valued Contributor

Re: HardCode Value

try like this:

tmp:
LOAD * INLINE [
Dim, Val, Val1
A, 10, 100
B, 20, 200
C
]
;

Concatenate
Load
'C'
as Dim,
sum(Val) as Val,
sum(Val1) as Val1
Resident tmp;

regards

tim

priyarane
Contributor III

Re: HardCode Value

It will work but my actual datamodel is huge so I cannot touch it so I need it as expreesion.

thanks for the reply.

prma7799
Honored Contributor III

Re: HardCode Value

Have you tried this

if(Dim = 'C', $(=sum(Val1)),sum(Val1))

zhadrakas
Valued Contributor

Re: HardCode Value

if(Dim='C', sum(TOTAL if(match(Dim, 'A', 'B'), Val1)))

or

if(Dim='C', sum(TOTAL if(Dim <> 'C', Val1)))

priyarane
Contributor III

Re: HardCode Value

tried but no luck

priyarane
Contributor III

Re: HardCode Value

tried but no luck

bhargav_bhat
Contributor II

Re: HardCode Value

Hi,

Please let me know if this works

if(Dim='C',sum({$<Dim=>} Val1),sum(Val1))

zhadrakas
Valued Contributor

Re: HardCode Value

didn't realize that you want to select 'C'.

Then you use Set Analysis the remove the selection

if(Dim='C', Sum({<Dim=>}Val1), sum(Val1))

priyarane
Contributor III

Re: HardCode Value

it is already tried and it is not working

Community Browser