Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
priyarane
Specialist
Specialist

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
Creator III
Creator III

Please find new app for solution.

View solution in original post

15 Replies
zhadrakas
Specialist II
Specialist II

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
Specialist
Specialist
Author

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
Master III
Master III

Have you tried this

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

zhadrakas
Specialist II
Specialist II

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

or

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

priyarane
Specialist
Specialist
Author

tried but no luck

priyarane
Specialist
Specialist
Author

tried but no luck

bhargav_bhat
Creator II
Creator II

Hi,

Please let me know if this works

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

zhadrakas
Specialist II
Specialist II

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
Specialist
Specialist
Author

it is already tried and it is not working