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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Get specific value from table by a field name

Hello ,

I have this tables in my project:

Main_Table:

[Part Family Name][Child1][Child2][Child3][Type][Type #]
AA1111AA1AA12345AA6548M11
BB2355BB98744BB65432BB6581111M12
CC24CC55555CC874654CC988877M21
DD235488DD88452DD46888D2M22

More_Details_Table:

[Part Name_A][Type]Some other more columns...
AA1M1...
AA12345M1...
AA6548
M1...
BB98744M1...
BB65432M1...
BB6581111M1...
CC55555
M2...
CC874654M2...
.........

Balance_Table:

[Part Name_A]Balance
AA1200
AA1234511
AA6548100
BB987448
BB6543281
BB658111182
CC5555583
CC87465484
......

* The Main_Table connected to More_Details_Table by the Type field (key).

* The More_Details_Table connected to Balance_Table by the [Part Name_A] field (key).

I created some straight table with:

1 Dimension: [Type], [Type #]

3 Expressions

* My selection is on the [Type] field, for example I selected and filtered the Types and show only M1 Type:

The Straight table now looks like this:

[Type][Type #]First LevelSecond LevelThird Level
M11
M12

On the expressions I'm trying to display this content:

On each cell I want the associated Child, for example on First Level column:

[Type][Type #]First LevelSecond LevelThird Level
M11AA1
M12BB98744

Additionally, I need to add a second row on each cell that contain the balance that associated to the specific Child name, for example:

[Type][Type #]First LevelSecond LevelThird Level
M11

AA1

200

M12

BB98744

8

I tried to write something like:

=[Child1] & Chr(13) &

only({$<[Part Name_A] = p([Child1]) >} [Balance])

but got only the Child name (AA1 on the first cell and BB98744 on the second)...

Also I tried to use FieldValue function but the position of each value changed when I have lots of Types...

please help me with this...

This is the final table I need to get (after selected and filtered the Type field to 'M1' value):

[Type][Type #]First LevelSecond LevelThird Level
M11

AA1

200

AA12345

11

AA6548

100

M12

BB98744

8

BB65432

81

BB6581111

82

Many Thanks for your support,

Itsik

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Ok Itsik,

Here is what are the values on my example ( and I attached the file again, just in case 😞

       

TypeType #First LevelFirst Level -
  Balance
Second LevelSecond Level - BalanceThird LevelThird Level -
  Balance
M11AA1
  200
200AA12345
  11
11AA6548
  100
100
M12BB98744
  8
8BB65432
  81
81BB6581111
  82
82
M21CC55555
  83
83CC874654
  84
84CC988877
M22DD88452 DD46888 D2

View solution in original post

10 Replies
Anonymous
Not applicable
Author

See if this helps..

=[Child1]  & Chr(13) &  MaxString({$<[Part Name_A] = p([Child1]) >} [Balance])

or

=[Child1]  & Chr(13) &  Max({$<[Part Name_A] = p([Child1]) >} [Balance])

Not applicable
Author

This returns me the same balance (the last child balance) to the two cells...

like this:

[Type]     [Type #]      First Level     Second Level     Third Level

---------------------------------------------------------------------------------------------

M1          1               AA1         

                               8


M1          2               BB98744

                                          8

Anonymous
Not applicable
Author

Try this.

Hope it helps

Anonymous
Not applicable
Author

Hello Itsik.

Try

Child1 & Chr(13) & FieldValue('Balance',  FieldIndex ( 'PartName_A', Child1 ))

Not applicable
Author

Hi Lucas,

The expresiion gives me some wrong balance values...

The strange thing is when I put all the expression:

=Child1 & Chr(13) & FieldValue('Balance',  FieldIndex ( 'PartName_A', Child1 ))

I got some right values of the Child1 before Chr(13) but wrong values at the balance...

And if I cut the begining of the expression and write only:

=FieldValue('Balance',  FieldIndex ( 'PartName_A', Child1 ))

I've got the same balance at two cells a wrong one, and different from the two that was before with the complete expression...

Anonymous
Not applicable
Author

Hello Itsik,

That is weird, with the examples that I got  from your model, I could reach the exact result that you desired.

Please, try loading your datamodel in the Attached file ( has the same columns names as yours ), to see if you get any wrong result.

Not applicable
Author

I'll Do one more check and Upload my file if it dont success...

Anonymous
Not applicable
Author

Ok Itsik,

Here is what are the values on my example ( and I attached the file again, just in case 😞

       

TypeType #First LevelFirst Level -
  Balance
Second LevelSecond Level - BalanceThird LevelThird Level -
  Balance
M11AA1
  200
200AA12345
  11
11AA6548
  100
100
M12BB98744
  8
8BB65432
  81
81BB6581111
  82
82
M21CC55555
  83
83CC874654
  84
84CC988877
M22DD88452 DD46888 D2
Not applicable
Author

Your example is really work, but in my project, with my data it didnt... I dont know why...

I'll check with my company if I can upload some of the real data to show you...

Thank you for everything so far...