cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Tomsg89 Frequent Visitor
Frequent Visitor

Create a multiple line chart per Country level

Hi All

 

I am learning power BI currently and had just started since 2 days ago. I am trying to figure out on how to create a line report which showing the values per quarter by country level.

Expected:

Capture.PNG

Sample data as follow:

Country
2019Q2
2019Q12018Q42018Q32018Q2
Vietnam543-21
Thailand67853
China234105
Cambodia54321
Indonesia-4-5431

 

I couldnt get it works unless I transposed the table into below:

CountryVietnamThailandChinaCambodiaIndonesia
2019Q25625-4
2019Q14734-5
2018Q438434
2018Q3-251023
2018Q213511

 

However if the table transposed as above, i couldn't add the country as filter, only quarter..

Is there any way to create the multiple Line chart per countries which filterable by the countries?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
janssensn Occasional Visitor
Occasional Visitor

Re: Create a multiple line chart per Country level

Hi @Tomsg89 ,

 

at first you need to unpivot the last 5 columns of your original data ( > Transform > Unpivot columns) so that you get a table like this:

 

Country Quarter Value

Vietnam2019Q25
Vietnam2019Q14
Vietnam2018Q43
Vietnam2018Q3-2
Vietnam2018Q21
Thailand2019Q26
Thailand2019Q17
Thailand2018Q48
Thailand2018Q35
Thailand2018Q23
China2019Q22
China2019Q13
China2018Q44
China2018Q310
China2018Q25
Cambodia2019Q25
Cambodia2019Q14
Cambodia2018Q43
Cambodia2018Q32
Cambodia2018Q21
Indonesia2019Q2-4
Indonesia2019Q1-5
Indonesia2018Q44
Indonesia2018Q33
Indonesia2018Q21

 

With this query result you can create your multiple line visual and sort it by quarter:

 

multlinevisual.pngVoila!

 

View solution in original post

3 REPLIES 3
janssensn Occasional Visitor
Occasional Visitor

Re: Create a multiple line chart per Country level

Hi @Tomsg89 ,

 

at first you need to unpivot the last 5 columns of your original data ( > Transform > Unpivot columns) so that you get a table like this:

 

Country Quarter Value

Vietnam2019Q25
Vietnam2019Q14
Vietnam2018Q43
Vietnam2018Q3-2
Vietnam2018Q21
Thailand2019Q26
Thailand2019Q17
Thailand2018Q48
Thailand2018Q35
Thailand2018Q23
China2019Q22
China2019Q13
China2018Q44
China2018Q310
China2018Q25
Cambodia2019Q25
Cambodia2019Q14
Cambodia2018Q43
Cambodia2018Q32
Cambodia2018Q21
Indonesia2019Q2-4
Indonesia2019Q1-5
Indonesia2018Q44
Indonesia2018Q33
Indonesia2018Q21

 

With this query result you can create your multiple line visual and sort it by quarter:

 

multlinevisual.pngVoila!

 

View solution in original post

Super User IV
Super User IV

Re: Create a multiple line chart per Country level

Hi @Tomsg89 

 

Please see the attached file with the solution.

All you need to do is use Unpivot on all Quarter column instead of the Transpose.

 

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
Mariusz Repczynski

 

 

Tomsg89 Frequent Visitor
Frequent Visitor

Re: Create a multiple line chart per Country level

Thanks a lot for the solution! It works like a charm!

@Mariusz @janssensn 

Helpful resources

Announcements
Exclusive LIVE Community Event #3 – Ask Arun Anything

Exclusive LIVE Community Event #3 – Ask Arun Anything

Join us in the third Triple A event!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

January 2020 Community Highlights

January 2020 Community Highlights

Make sure you didn't miss any of the things that happened in the community in January!

Top Solution Authors
Top Kudoed Authors