Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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
janssensn
New Member

Hi @Anonymous ,

 

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
Anonymous
Not applicable

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

@Mariusz @janssensn 

Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

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

 

 

janssensn
New Member

Hi @Anonymous ,

 

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!

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.