Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

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

  • Anonymous's avatar
    Anonymous
    8 years ago

    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])
    )
    )

4 Replies

    • Anonymous's avatar
      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

       

       

      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's avatar
        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])
        )
        )