Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
bernhardiner
Contributor
Contributor

Subfield and sets

Hello,

I'm having problems with using subfields in set expressions. I have a table called T which consists of two columns %KeyT and ValueT.

The data in T looks like this

%KeyT
ValueT
ID1|201625
ID2|201675
......
ID1|201340
ID2|201360

I want to display all the values for ID1. I've tried to use a set expression with a subfield(%KeyT, '|', 1) function to split the %KeyT field and only display ID1-values but that doesn't work. Any ideas on how to do this?

5 Replies
suryaa30
Creator II
Creator II

You can use %KeyT as dimension and ValueT in expression. For ValueT use below expression.


only({<%KeyT={"ID1*"}>} ValueT)

rohitraut
Creator
Creator

Hello Henrik,

Try this ,

if(wildmatch( %KeyT,'ID1*'),ValueT)

its_anandrjs
Champion III
Champion III

In the Calculated dimension try to write one of this that is working

=SubField('ID1|2016', '|',-2)

Or

=SubField('ID1|2016', '|',1)

Anil_Babu_Samineni

May be these?

Sum({<%KeyT = {'ID1*'}>} ValueT)

OR

Sum({<%KeyT = P({<%KeyT = {'ID1*'}>} %KeyT)>} ValueT)

OR

Sum(Aggr(If(WildMatch(%KeyT, 'ID1*'), Sum(ValueT)), %KeyT))

OR

Sum({<%KeyT = {"=Match(Left(%KeyT, 3),'ID1')"}>}ValueT)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
its_anandrjs
Champion III
Champion III

There is other ways for this also

Dim:- =If(WildMatch(%KeyT , 'ID1*' , %KeyT)

//Note:- Suppress when value is null selected


Expression:- Sum(ValueT)