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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Anonymous
Not applicable

How to setup multiple columns for visualization

Hi all,

 

I have been wrestling with an issue that was partially addressed by this forum but I can't quite get to a final solution. I am hoping the explanation below will help paint a picture of what I'm trying to achieve and hopefully someone much more clever than me will have a suggestion 🙂

 

I have a pbi file with multiple tables linked to Oracle, two of which are of particular interest:

. one table 'Transactions' which pulls all purchase transactions (thousand of lines of purchase orders) with a column containing a stock number [STOCK NUMBER]. THis stock number appears multiple times in the table

. one table 'Current Inventory' which pulls all distinct stock numbers along with various data such as drawing number, manufacturer details, etc. I have 4 columns of interest [Manufacturer #1], [Manufacturer #2], [Manufacturer #3] and [Manufacturer #4]. This is because one part can theoritically be manufactured by 4 different companies (whilst bought from only one).

 

I have already concatenated the 4 manufacturer columns so I can have a text filter to display all purchases relating to items falling under a specific manufacturer.

 

Now here is what I'd like to do: have a graph (ie pie chart) which shows me who are the manufacturers that are being the stock numbers we purchase the most. Problem is, stock number 1 could have vendor A listed in [Manufacturer #1], stock number 2 could have nothing, stock number 3 could have Vendor A listed in Manufacturer #1 as well as Manufacturer #2, etc etc.

 

I thought of creating a new table with two columns, one listing stock numbers (duplicated) and the other the manufacturers (being a combination of all 4 fields above). I'm not sure how to do this and then wonder what relationship to create to be able to do all this filtering.

 

Does anyone have a clever idea?


Thanks in advance 🙂

OF

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi all,

 

I inspired myself from another post and found my solution 🙂

 

Manufacturer = 
DISTINCT (
UNION (
       SELECTCOLUMNS('Current Inventory',"Manufacturer",'Current Inventory'[Manufacturer #1]),
       SELECTCOLUMNS('Current Inventory',"Manufacturer",'Current Inventory'[Manufacturer #2]),
       SELECTCOLUMNS('Current Inventory',"Manufacturer",'Current Inventory'[Manufacturer #3]),
       SELECTCOLUMNS('Current Inventory',"Manufacturer",'Current Inventory'[Manufacturer #4]),
       SELECTCOLUMNS('Current Inventory',"Manufacturer",'Current Inventory'[Manufacturer #5]),
       SELECTCOLUMNS('Current Inventory',"Manufacturer",'Current Inventory'[Manufacturer #6]),
       SELECTCOLUMNS('Current Inventory',"Manufacturer",'Current Inventory'[Manufacturer #7]),
       SELECTCOLUMNS('Current Inventory',"Manufacturer",'Current Inventory'[Manufacturer #8]),
       SELECTCOLUMNS('Current Inventory',"Manufacturer",'Current Inventory'[Manufacturer #9]),
       SELECTCOLUMNS('Current Inventory',"Manufacturer",'Current Inventory'[Manufacturer #10]),
       SELECTCOLUMNS('Current Inventory',"Manufacturer",'Current Inventory'[Manufacturer #11])
)
)

View solution in original post

4 REPLIES 4
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

Please illustrate your scenario with sample data and image of desired output to help us better understand.

How to Get Your Question Answered Quickly

 

Regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hello,

 

Below is an example of what my table would look like (with a lot more information in the middle). Important to note here that there are no duplicates in the STOCK NUMBER column as it is used on a 1 to many relationship

 

STOCK NUMBERManufacturer 1Manufacturer 2Manufacturer 3Manufacturer 4
700000007VolvoBMW  
700000010FordToyotaVolvo 
700000230VWAlpha RomeoHondaBMW
700000440HondaToyotaLexusVolvo
700000560Hyundai   

 

Below is an example of what visual I am trying to achieve

 

Example graph.png

 

Effectively list all the manufacturers (without duplicates) across all tables with a count of stock numbers they are listed against.

 

Does anyone have a clever suggestion?

 

Anonymous
Not applicable

Hi all,

 

I inspired myself from another post and found my solution 🙂

 

Manufacturer = 
DISTINCT (
UNION (
       SELECTCOLUMNS('Current Inventory',"Manufacturer",'Current Inventory'[Manufacturer #1]),
       SELECTCOLUMNS('Current Inventory',"Manufacturer",'Current Inventory'[Manufacturer #2]),
       SELECTCOLUMNS('Current Inventory',"Manufacturer",'Current Inventory'[Manufacturer #3]),
       SELECTCOLUMNS('Current Inventory',"Manufacturer",'Current Inventory'[Manufacturer #4]),
       SELECTCOLUMNS('Current Inventory',"Manufacturer",'Current Inventory'[Manufacturer #5]),
       SELECTCOLUMNS('Current Inventory',"Manufacturer",'Current Inventory'[Manufacturer #6]),
       SELECTCOLUMNS('Current Inventory',"Manufacturer",'Current Inventory'[Manufacturer #7]),
       SELECTCOLUMNS('Current Inventory',"Manufacturer",'Current Inventory'[Manufacturer #8]),
       SELECTCOLUMNS('Current Inventory',"Manufacturer",'Current Inventory'[Manufacturer #9]),
       SELECTCOLUMNS('Current Inventory',"Manufacturer",'Current Inventory'[Manufacturer #10]),
       SELECTCOLUMNS('Current Inventory',"Manufacturer",'Current Inventory'[Manufacturer #11])
)
)

Hello!  I am trying to do something very similar but am having trouble applying your solution.  can you please tell me what the "Manufacturer" piece refers to in your example?

 

The error I'm getting states: "a table of multiple values was supplied where a single value was expected"

 

Manufacturer =
DISTINCT (
UNION (
       SELECTCOLUMNS('Current Inventory',"Manufacturer",'Current Inventory'[Manufacturer #1]),
       SELECTCOLUMNS('Current Inventory',"Manufacturer",'Current Inventory'[Manufacturer #2]),
       SELECTCOLUMNS('Current Inventory',"Manufacturer",'Current Inventory'[Manufacturer #3]),
       SELECTCOLUMNS('Current Inventory',"Manufacturer",'Current Inventory'[Manufacturer #4]),
       SELECTCOLUMNS('Current Inventory',"Manufacturer",'Current Inventory'[Manufacturer #5]),
       SELECTCOLUMNS('Current Inventory',"Manufacturer",'Current Inventory'[Manufacturer #6]),
       SELECTCOLUMNS('Current Inventory',"Manufacturer",'Current Inventory'[Manufacturer #7]),
       SELECTCOLUMNS('Current Inventory',"Manufacturer",'Current Inventory'[Manufacturer #8]),
       SELECTCOLUMNS('Current Inventory',"Manufacturer",'Current Inventory'[Manufacturer #9]),
       SELECTCOLUMNS('Current Inventory',"Manufacturer",'Current Inventory'[Manufacturer #10]),
       SELECTCOLUMNS('Current Inventory',"Manufacturer",'Current Inventory'[Manufacturer #11])
)
)

Helpful resources

Announcements
FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.