Forum Discussion

gtanya33's avatar
gtanya33
New Member
4 years ago
Solved

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.

 

 

  • 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.

    Here's my solution.

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

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

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

    Result:

    3.Add a custom column.

     

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

     

    Result:

    4.Split the year column by "_"

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

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

    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.

     

1 Reply

  • 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.

    Here's my solution.

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

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

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

    Result:

    3.Add a custom column.

     

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

     

    Result:

    4.Split the year column by "_"

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

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

    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.