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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
surfboarder1998
New Member

Combine Columns

I currently have a report that lists a primary and support person in two separate columns. It also lists the percent allocation for the primary person and a percent allocation for the support person in separate columns. Since anyone on the team can be support and lead on separate projects simultaneously I would like to show total that each person is utilized. I would have to add each of their total Lead and Support allocations in a stacked bar chart.

 

Example:

surfboarder1998_0-1689621959810.png

 

Thank you for any help that you can give and I look forward to hearing back from the forum.

1 ACCEPTED SOLUTION

@surfboarder1998

Then I'd flatten the initial table with the code below, rename manually "Lead Name" into just "Name" (it can be also done in [DAX] via SELECTCOLUMNS) and use this flattened table in visuals.

barritown_0-1689839946805.png

In plain text:

Table = 
UNION (
    SUMMARIZE ( Data, [Work Status], [Segment], [Lead Name], 
                "Role", "Lead",
                "Allocation", SUM ( Data[Lead Allocation] ) ),
    FILTER (
        SUMMARIZE ( Data, [Work Status], [Segment], [Support Name], 
                    "Role", "Support",
                    "Allocation", SUM ( Data[Support Allocation] ) ),
        NOT ISBLANK ( [Support Name] ) ) )

Best Regards,

Alexander

My YouTube vlog in English

My YouTube vlog in Russian

View solution in original post

6 REPLIES 6
barritown
Super User
Super User

Hi @surfboarder1998,

One of the options is to reorganize your table into a summary like the one below, then you can easily create a bar chart using its columns.

barritown_0-1689668854678.png

In plain text for convenience:

People = 
ADDCOLUMNS ( 
    SELECTCOLUMNS (
        FILTER ( 
            DISTINCT ( 
                UNION ( 
                    VALUES ( Data[Lead Name] ), 
                    VALUES ( Data[Support Name] ) ) ),
        ISBLANK( [Lead Name] ) = FALSE() ),
    "Name",
    [Lead Name] ),
"Lead",
VAR CurrentName = [Name]
RETURN SUMX ( FILTER ( Data, [Lead Name] = CurrentName), [Lead Allocation] ),
"Support",
VAR CurrentName = [Name]
RETURN SUMX ( FILTER ( Data, [Support Name] = CurrentName), [Support Allocation] ) )

Best Regards,

Alexander

My YouTube vlog in English

My YouTube vlog in Russian

 

Thanks very much barritown. This solution works well. I was wondering if it would also work if I needed to have two additional fields added to it, SEGMENTATION and WORK STATUS. Both are text fields. I have added them to an example below.

 

surfboarder1998_0-1689694527438.png

 

Could the code above be adjusted to add this in to the summary table?

@surfboarder1998,

Could you please clarify how you see the final result with these additional columns? Do you plan any additional slicing by Work Status or Segment?

I plan to slice by Work Status and use the Segment in the legend. Right now, the way that you have shown them would be great. I would be able to total the two allocation columns and and that total would still be for a specific Segment and have a specific Work Status.

 

I hope this makes sense. Let me know if there's more clarification I can provide and thank you very much for your help.

@surfboarder1998

Then I'd flatten the initial table with the code below, rename manually "Lead Name" into just "Name" (it can be also done in [DAX] via SELECTCOLUMNS) and use this flattened table in visuals.

barritown_0-1689839946805.png

In plain text:

Table = 
UNION (
    SUMMARIZE ( Data, [Work Status], [Segment], [Lead Name], 
                "Role", "Lead",
                "Allocation", SUM ( Data[Lead Allocation] ) ),
    FILTER (
        SUMMARIZE ( Data, [Work Status], [Segment], [Support Name], 
                    "Role", "Support",
                    "Allocation", SUM ( Data[Support Allocation] ) ),
        NOT ISBLANK ( [Support Name] ) ) )

Best Regards,

Alexander

My YouTube vlog in English

My YouTube vlog in Russian

This is exactly the solution I was looking for. Thank you so much for your help barritown.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.