Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
caramel_mumu
Contributor II
Contributor II

How to split 1 dimension into 2 fields

I have a database like this

Student Name Subject Result
A Math 100
A Science 90
B Math 95
B Science 80

 

And I want to put it in a table like this

Student Name Math Science
A 100 90
B 95 80

 

is there a way to do this without changing the back end? I only have access to the front end

so far what I do is use the if function

if(Subject = 'Math', Result, null()) & if(Subject = 'Science', Result, null())

but the result is like this

Student Name Math Science
A 100 -
A - 90
B 95 -
B - 80

 

please help. Thankyou

Labels (4)
4 Replies
L_Hop
Creator
Creator

Hi Caramel_mumu,

may be you may convert data in script side and get what you want.

First, I found student A result and then found student B result and keep results in two fields (math and science).

then I Concatenate the results and get the final result.

regards.

RafaelBarrios
Partner - Specialist
Partner - Specialist

Hi @caramel_mumu 

you can try the following

Dimension: [Student Name]

Measure1: sum({< Subject={'Math'}  >} Result)

Measure2: sum({< Subject={'Science'}  >} Result)

 

but, its better to be done by script by using Generic Load

https://help.qlik.com/en-US/sense/may2023/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptPrefixes/...

 

Hope it helps,

help users find answers! Don't forget to mark a solution that worked for you & to smash the like button😁

caramel_mumu
Contributor II
Contributor II
Author

hi, thankyou

but I've tried this and it produced the same result like what I've showed in my question 😞

MayilVahanan

Hi

@RafaelBarrios solution will work..

Include only one dimension - Student Name and 2 measures [1 for Math & 1 for Science]

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.