15 Replies Latest reply: Jul 18, 2017 5:19 AM by Ravi Balar

# 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

• ###### Re: HardCode Value

try like this:

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

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

regards

tim

• ###### 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.

• ###### Re: HardCode Value

Have you tried this

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

• ###### Re: HardCode Value

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

or

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

• ###### Re: HardCode Value

tried but no luck

• ###### Re: HardCode Value

tried but no luck

• ###### 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))

• ###### Re: HardCode Value

it is already tried and it is not working

• ###### Re: HardCode Value

that should work. can you share a sample qvw?

• ###### Re: HardCode Value

Hi,

Please let me know if this works

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

• ###### Re: HardCode Value

it is already tried and it is not working

• ###### Re: HardCode Value

PLease find application with same set of data.

• ###### Re: HardCode Value

Hi Thanks for the effort, if I select A then C is disappearing, it should not happen

• ###### Re: HardCode Value

Hi Priya,

Please find attached solution.

Regards,

Pankaj