Forum Discussion

TristanO's avatar
TristanO
New Member
8 years ago
Solved

Grouping Data from one column to create graph

Hi All,

 

I am attempting to create a pie graph to show management how many hours are being billed out by each department but in order to do that I need to group together multiple job codes that are in the same column of a table.

 

Below is an example of part of the table -

 

Job CodeHours
EL-2350664
EL-2351554
EL-2352362
EL-235323
ME-123423
ME-1235326
ME-123662
AT-776235
AT-7763235
AT-7764636
O-503352
O-50463
O-505363

 

Basically what I want to do is set a filter that will group AT, EL, ME and O into their own groups and add the hours then create a pie graph that has the 4 created groups.

 

Because this data source is constantly updated I need the filter in place because new job codes are always being added.

 

Is there a way to do this from within Power BI Desktop?

 

Thanks in advance.

  • Anonymous's avatar
    Anonymous
    8 years ago

    TristanO,

    Create a column using DAX below in your  table.
    GroupName = LEFT(Table[Job Code],FIND("-",Table[Job Code])-1)

    Then create a pie chart as follows. When new job codes are added, just click "Refresh" button in Power BI Desktop to bring the new data.


    Regards,
    Lydia

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    TristanO,

    Create a column using DAX below in your  table.
    GroupName = LEFT(Table[Job Code],FIND("-",Table[Job Code])-1)

    Then create a pie chart as follows. When new job codes are added, just click "Refresh" button in Power BI Desktop to bring the new data.


    Regards,
    Lydia

  • Hi,

     

    You may also split data in the Query Editor window by using - as a delimiter.