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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

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
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!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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