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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
VrowePPA
Frequent Visitor

Create a chart by isolating the multi-select values in the column

I have a field in my table, where in my source data, products are selected from a multi select list of 9 items. eg:

Upgrade licences;Training;Technical Service Agreement
Upgrade licences;Training;Implementation;Technical Service Agreement
Upgrade licences;Training;Implementation
Upgrade licences;Training;Implementation
New licences;Training;Implementation;Technical Service Agreement

 

I'd like to create a visual like the one below, where I get a count of each of the nine items, eventhough they might appear in a string with other items.

VrowePPA_0-1680562802082.png

 

In visuals, I can't figure out how to isolate the 9 values I want to see. Instead, I get a chart with every permutation/ combination of the values selected.

VrowePPA_1-1680562922471.png

 

In the data table, I created 9 new columns with a function to populate the field if the value occurs. I thought I could create a chart out of these. But I get the same count for every column when I create a visual.

I used this formula to create each column. 

= Table.AddColumn(#"Added Custom8", "SaleTSA", each if Text.Contains([Sale Type], "Technical service agreement") then "Technical service agreement" else "")

VrowePPA_2-1680563096802.png

 

What is the best way please to isolate and count my 9 products and show it on a chart like this one?

VrowePPA_3-1680563312331.png

 

Here is my data: https://pythapartners.com.au/wp-content/uploads/2023/04/Example-products-table.xlsx

 

1 ACCEPTED SOLUTION

You will have to start building out your model into related dimensions and fact table(s). E.g. here is the Adventure Works model:

MarkLaf_0-1680576191230.png

Your particular model will depend on your source data and business rules. If you have or can you create a Bids table where a single product is tagged at the transactional level, then you can use that for your product count and you will most likely want to relate your Bid table to a Product dimension table like shown above. Or does a single row in your transactional data have multiple products associated with it?

View solution in original post

5 REPLIES 5
MarkLaf
Solution Sage
Solution Sage

You'll want to split your column by the ";" delimiter into a row for each product and then can do a simple row count by product.

Conveniently, this can be done through the Power Query UI without needing to write any M:

1) right-click on column header and select Split Column > By Delimiter...

MarkLaf_0-1680569242666.png

2) select your delimiter ( ; ), select split at each occurence, and be sure to expand the Advanced options and change split into option to rows:

MarkLaf_1-1680569394189.png

3) close and apply out of Power Query, now you can drop your column into the x-axis and y-axis of a bar chart. For the y-axis, Power BI will automatically convert this to an aggregation; for text columns, this aggregation should be count, which is what you want:

MarkLaf_2-1680569694820.png

 

Thank you @MarkLaf . That solutions works brilliantly to create the chart. But... it seems to also add to the total number of rows, which affects other sales stats. I'm guessing that if there are three delimited items, then there will essentially be the same sale, but in triplicate on three rows. For example: sample stats before making delimiter changes

VrowePPA_1-1680571994736.png

 

 

And here is the same sample parameters but after applying the changes to get the chart to work.

VrowePPA_0-1680571949199.png

 

Do you have any suggstions on how to address this?  Thanks again so far.

Sample Data: https://pythapartners.com.au/wp-content/uploads/2023/04/Example-products-table-2.xlsx

You will have to start building out your model into related dimensions and fact table(s). E.g. here is the Adventure Works model:

MarkLaf_0-1680576191230.png

Your particular model will depend on your source data and business rules. If you have or can you create a Bids table where a single product is tagged at the transactional level, then you can use that for your product count and you will most likely want to relate your Bid table to a Product dimension table like shown above. Or does a single row in your transactional data have multiple products associated with it?

Thank you @MarkLaf . I understand the idea you've supplied but it's a bit beyond my skill level at the moment. I'll work on it!  🙂  In the meantime, I did manage to make a series of measures which at least have created a visual, although of course it isn't too dynamic.

 

Thanks again.

@VrowePPA, actually I'm only now realizing that you had provided some sample data, which makes it much easier for me to provide a more targeted recommendation. I believe you can achieve what you want with just one additional table.

 

To do this, create a new blank query, click advanced editor, then paste in the following:

 

let
    Source = Data, //Change Data to whatever name you have for your base table
    Select = Table.SelectColumns(Source,{"Sale Type"}),
    Rename = Table.RenameColumns(Select,{{"Sale Type", "Sale Type Group"}}),
    AddSplitTypes = 
        Table.AddColumn(
            Rename, 
            "Sale Type", 
            each Text.Split( [Sale Type Group], ";" ), 
            type {text} 
        ),
    ExpandSaleType = Table.ExpandListColumn(AddSplitTypes, "Sale Type"),
    Distinct = Table.Distinct(ExpandSaleType)
in
    Distinct

 

Note that the only thing you will probably have to tailor is the reference in Source - this should be the name of your base table in Power Query.

 

This will provide a table where it matches each group of products to applicable product rows:

MarkLaf_0-1680739811965.png

 

Load both tables into the model and create the following relationship between them; in my example 'Data' is your main table and 'Sales Type' is the new table we've created:

MarkLaf_1-1680739962161.png

Once you create the relationship, your model diagram should look like:

MarkLaf_2-1680740167248.png

 

You can now drag and drop in a count of an ID column, Amount, or construct measure that will automatically be filtered by 'Sales Types'[Sale Type]:

MarkLaf_3-1680740493859.png

 

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.