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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
gtanya33
New Member

Getting data to show subcategories

I am extremely new to PowerBi (this is the first dataset I'm trying to pull in).  The issue I'm running into is that my dataset has the count of students enrolled for each of our emphasis areas and then it has columns that show the semester and the year as a subcategory.  How do I pull this data in so that we can then look up trends for that particular emphasis area.

 

gtanya33_0-1654701157703.png

 

1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @gtanya33 ,

According to your description, you want to use Power BI do some analysis with the data structure you showed.

I create a sample.

vkalyjmsft_0-1655100241855.png

Here's my solution.

In Power Query, after getting data, it display like this:

vkalyjmsft_1-1655100657124.png

1.Select Use First Row as Headers, get this:

vkalyjmsft_3-1655100867880.png

2.Select all the Year column at the same time, then click Unpivot Columns.

vkalyjmsft_4-1655100982321.png

Result:

vkalyjmsft_5-1655101041466.png

3.Add a custom column.

vkalyjmsft_7-1655101193106.png

 

Semester = if Text.Contains([Attribute],"_")then "Winter" else "Fall"

 

Result:

vkalyjmsft_6-1655101155047.png

4.Split the year column by "_"

vkalyjmsft_8-1655101352275.png

5.After remove the unneeded column and rename columns, get this table:

vkalyjmsft_11-1655101756943.png

Now, you can use a line chart to display the trend of each emphasis or a matrix to show the data.

vkalyjmsft_12-1655101804482.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

1 REPLY 1
v-yanjiang-msft
Community Support
Community Support

Hi @gtanya33 ,

According to your description, you want to use Power BI do some analysis with the data structure you showed.

I create a sample.

vkalyjmsft_0-1655100241855.png

Here's my solution.

In Power Query, after getting data, it display like this:

vkalyjmsft_1-1655100657124.png

1.Select Use First Row as Headers, get this:

vkalyjmsft_3-1655100867880.png

2.Select all the Year column at the same time, then click Unpivot Columns.

vkalyjmsft_4-1655100982321.png

Result:

vkalyjmsft_5-1655101041466.png

3.Add a custom column.

vkalyjmsft_7-1655101193106.png

 

Semester = if Text.Contains([Attribute],"_")then "Winter" else "Fall"

 

Result:

vkalyjmsft_6-1655101155047.png

4.Split the year column by "_"

vkalyjmsft_8-1655101352275.png

5.After remove the unneeded column and rename columns, get this table:

vkalyjmsft_11-1655101756943.png

Now, you can use a line chart to display the trend of each emphasis or a matrix to show the data.

vkalyjmsft_12-1655101804482.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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