Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join this live chat April 6, 10AM EST - QlikView to Qlik Sense REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
kmswetha
Creator
Creator

set analysis with 2 different data types

Hi,

I'm having a set analysis with alternate sates where I have show data of 2 different data types, Both number and string

Here is what i'm using,
MaxString({[state1]<field1={1}>}value)+sum({[state1]<field1={2}>}value)
since data is of 2 different data types set analysis is not performing OR operation.


Other way i'm trying is using if condition but not sure how to use alternate states in if condtion.


Any suggestions?

20 Replies
kmswetha
Creator
Creator
Author

I did that mark, But you cannot concatenate in front end right? that ends up again as two different data types

mark6505
Partner
Partner

Hi,

IF you do your calculation as normal with the numbers and ignore the special char, once you are happy with the result you can add an if to your set analysis like

'Your Set analysis'&IF(SUM(Special)= 1,'*')

Or even have a different way to visualise it, with a coloured text or field.

kmswetha
Creator
Creator
Author

I tried even concatenating.

I used something like

(sum({[state1]<F3={1}>}value1)&'*')

+

sum(F3={2}>}value).

Even this is not working

mark6505
Partner
Partner

HI,

You won't be able to sum a string and num. The only way it will work is to do you calculation first and then add the special character on afterwards. So above would be something like

(sum({[state1]<F3={1}>}value1)

+

sum(F3={2}>}value)&'*')

Mark

kmswetha
Creator
Creator
Author

The one you have written will append for entire expression. * has to come up only when F3 is 1. I cannot append * for entire expression. Would need only for this expression

sum({[state1]<F3={1}>}value1)&'*'

sunny_talwar

For this data that you have provided

load * Inline [
F1, F2.F3
abc, 9*,1
def, 10,2
ab, 100,2
]
;


What should the final output look like?

mark6505
Partner
Partner

Hi Swe,

Yes it would I was just using your example, but as I was trying to explained in the pervious post, if you flag the fields in the data that have a special character you can then us an if statement to add the * back in where need

(sum({[state1]<F3={1}>}value1)

+

sum(F3={2}>}value)& IF(Special= 1,'*')

you may need something like IF(ONLY(Special)= 1,'*')

kmswetha
Creator
Creator
Author

Hi Sunny,

Something like this. Final output filed will have both number and strings

sunny_talwar

So if the data would have looked like this

load * Inline [
F1, F2.F3
abc, 9*,50
def, 10,2
ab, 100,2
]
;

then it would be 450* for abc? If that is true... may be you need this

KeepChar(F2, '0123456789') * F3 & PurgeChar(F2, '0123456789')

kmswetha
Creator
Creator
Author

No.

There are alternate states too.

load * Inline [
F1, F2.F3,F4,
abc, 9*,1,9
def, 10,2,10
ab, 100,2,100
]
;

F3 field tells if there is a special character and F4 is removing the special character

Since there are alternate states I cannot use if condition

sum({[state1]<F3={1}>}F4)

+

sum(({[state2]<F3={2}>}F2)

Now till hear i'm able to display without * by converting to number.

Now if i have to concatenate * to the above expression, is it feasible?I have to concatenate to the first statement.

Which means sum({[state1]<F3={1}>}F4)