Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Jojo17
Contributor
Contributor

Subfield for Movie Genres

Hi there, 

my data looks as follows:

Genres:
Animation | Children | Comedy 
Fantasy 
Action | Adventure | Romance 
Drama | Thriller 


(and the list goes on, with each movie having various numbers of genres) 

Am looking to use the sub field function to do an assessment on the Genres, would need some help here, thank you! 🙂 

 

2 Solutions

Accepted Solutions
uacg0009
Partner - Specialist
Partner - Specialist

Hi Jodi,
I assume that you have "movie" and "genre" in your table.
And firstly you need to use subfield() in your srcipt,like:
load movie,
subfield(genre,'|') as genre
resident yourtable;
Then in the front-end, you can create a straight table:
dimension: genre
expression: count(distinct movie)
please try.
Aiolos Zhao

View solution in original post

Anil_Babu_Samineni

Error - Because, You are using same field with in the Single Load. Perhaps this?

LOAD MovieID,
            Title,
            Subfield(Genres, '|') as Genres

From Sample;

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

View solution in original post

7 Replies
Anil_Babu_Samineni

What you want from that data? May be

Subfield(FieldName, '|') as Output

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
Jojo17
Contributor
Contributor
Author

One movie is tagged to a few genres and I would like to have a chart which shows the various genres and the number of movies per genre. 

Anil_Babu_Samineni

Your data structure not understand to me. Can you create proper data and expected result 

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
uacg0009
Partner - Specialist
Partner - Specialist

Hi Jodi,
I assume that you have "movie" and "genre" in your table.
And firstly you need to use subfield() in your srcipt,like:
load movie,
subfield(genre,'|') as genre
resident yourtable;
Then in the front-end, you can create a straight table:
dimension: genre
expression: count(distinct movie)
please try.
Aiolos Zhao
Jojo17
Contributor
Contributor
Author

My data file looks as follows:

movie.PNG

I would like to create a chart which shows which genre is most popular. 

I tried the following: 

LOAD MovieID,
            Title,
            Genres

           Subfield(Genres, '|') as Genres

But it did not return a result and was an error. 

Anil_Babu_Samineni

Error - Because, You are using same field with in the Single Load. Perhaps this?

LOAD MovieID,
            Title,
            Subfield(Genres, '|') as Genres

From Sample;

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
Jojo17
Contributor
Contributor
Author

I see, thanks! Managed to get it to work now 🙂