Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Change granularity

Hello, I am working on a project to analyse certain customer opportunities and I want to analyse which employees are available per opportunity. Right now I have a table "new_candidates" with employee id's in (see sample data), the problem is that there are multiple employees in one row in the same column. So right now my granularity is one row per opportunity. I would like to change this to 1 row per employee opportunity/availability.

 

Sample data:

 

 

data right now:

start dateTopicCandidatesDescriptioncloudprobability
01/05/2020data lake10000003, 10000006, 10000009Description 11100
24/04/2020data integration10000010, 100000000Description 2270
05/05/2020Business Intelligence10000008Description 3190

 

Desired data:

start dateTopicCandidatesDescriptioncloudprobability
01/05/2020data lake10000003Description 11100
01/05/2020data lake10000006Description 11100
01/05/2020data lake10000009Description 11100
24/04/2020data integration10000010Description 2270
24/04/2020data integration100000000Description 2270
05/05/2020Business Intelligence10000008Description 3190

Any ideas?

  • mitsu's avatar
    mitsu
    6 years ago

    Good Point  this can be handled by creating a custom column , with text . split function .  Refer the following M code for your reference . 

     Reference : https://www.youtube.com/watch?v=9krfJLv8ENk

    let
    Source = Excel.Workbook(File.Contents("...Documents\Smap.xlsx"), null, true),
    Table1_Table = Source{[Item="Table1",Kind="Table"]}[Data],
    #"Changed Type" = Table.TransformColumnTypes(Table1_Table,{{"tart date", type date}, {"Topic", type text}, {"Candidates", type text}, {"Description", type text}, {"cloud", Int64.Type}, {"probability", Int64.Type}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Split Candidates", each Text.Split([Candidates],",")),
    #"Expanded Split Candidates" = Table.ExpandListColumn(#"Added Custom", "Split Candidates")
    in
    #"Expanded Split Candidates"

8 Replies

  • camargos88's avatar
    camargos88
    Community Champion

    Hi Anonymous ,

     

    You can split this column like:

     

     

     

    If you consider it as a solution, please mark as a solution and kudos.

    Ricardo

    • Anonymous's avatar
      Anonymous
      Not applicable

      Yes I know but that isn't what I am looking for. That way when I have a mapping table I still can't connect to that table. I need a row per employee for each opportunity

      • camargos88's avatar
        camargos88
        Community Champion

        Hi Anonymous ,

         

        Sorry, I didn't get what you need.

        Can you give more details ?

         

        Ricardo