Forum Discussion

Creative_tree88's avatar
1 year ago
Solved

Grouping Data - Sample Attached

Hi all - I have a dataset, which has multiple lines and each line of data has a service provided.  I need to produce a PBIX which allows me to show both the individual number of services we have offe...
  • v-echaithra's avatar
    1 year ago

    Hi Creative_tree88 ,

    Thank you for reaching out to Microsoft Community.

    To achieve a session-level summary view in Power BI, you can use Power Query to group and combine service data per session. The goal is to produce a clean table that shows one row per session (Cust No + Sess Date), with a Service Combo string, while also keeping key details like the Epi Number. Below are the steps, followed by how you can visualize this in Power BI.

    Step 1: Group by Cust No and Sess Date

    Open Power Query (Transform Data).
    Select the Cust No and Sess Date columns.
    Go to the Home tab and click Group By.
    In the Group By window:
    Group by: Cust No, Sess Date
    New column name: AllData
    Operation: All Rows

    Step 2: Create the Service Combo Column

    Go to Add Column > Custom Column.
    Name it Service Combo.
    Use the following formula to combine all services in that session:

    powerquery

    Text.Combine(List.Sort(Table.Column([AllData], "Service")), " + ")

    This concatenates all service codes in sorted order, separated by " + ".

    Step 3: Expand AllData Table

    Click the expand icon on the AllData column.
    Select only the Service and Epi Number columns to expand.
    This brings those values back into your query, aligning each service with its session and Service Combo.

    Step 4: Close & Apply

    Click Close & Apply to load your transformed data into Power BI.

    Step 5: Create a Summary Table in Power BI

    In the Data or Report view, create a new table visual (or use DAX if needed).
    Add the following fields:

    Cust No, Sess Date, Epi Number (use First inorder to pick just one), Service Combo

    Please refer to the sample pbix file attatched.

    Best Regards,
    Chaithra E.