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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
mshodge
Frequent Visitor

Sum Single Column based on Multiple Name Appearances Across Columns

Hopefully you can assist..  We have multiple people working on numerous packing efforts.  Their name can appear in Column 1, 2 or 3.  Column 1 is the lead and columns 2 and 3 assist.  When one person completes the job they get full credit, 2 then .5 with 3 shared at .33.

 

I want to show a table with the packer names across the top and the dates (data column not shown) on the left.  How do I sum a single column (Packs) when the names can appear in either column 1, 2 or 3?

 

Packedby1Packedby2Packedby3Packs
a  1
a  1
a  1
ab 0.5
ab 0.5
ab 0.5
ac 0.5
ac 0.5
ac 0.5
abc0.33
abc0.33
abc0.33
b  1
b  1
b  1
bc 0.5
bc 0.5
bc 0.5
c  1
c  1
c  1
1 ACCEPTED SOLUTION
Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @mshodge

 

You could pivot the so you have the data in a tall column using the following calculated table :

 

Table = UNION(
            SELECTCOLUMNS('Table1',"PackedBy",'Table1'[Packedby1],"Packs",[Packs]),
            SELECTCOLUMNS('Table1',"PackedBy",'Table1'[Packedby1],"Packs",[Packs]),
            SELECTCOLUMNS('Table1',"PackedBy",'Table1'[Packedby1],"Packs",[Packs])
            )

Then you and put the Packer in a Matrix visual on columns and the rows will sum up correctly.

 

 


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

2 REPLIES 2
Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @mshodge

 

You could pivot the so you have the data in a tall column using the following calculated table :

 

Table = UNION(
            SELECTCOLUMNS('Table1',"PackedBy",'Table1'[Packedby1],"Packs",[Packs]),
            SELECTCOLUMNS('Table1',"PackedBy",'Table1'[Packedby1],"Packs",[Packs]),
            SELECTCOLUMNS('Table1',"PackedBy",'Table1'[Packedby1],"Packs",[Packs])
            )

Then you and put the Packer in a Matrix visual on columns and the rows will sum up correctly.

 

 


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Awesome.  Great response Phil.  Thank you.  I changed each line to Packedby1 to Packedby2 and 3.  I then filtered out the blanks (there will be many more blanks than data).

 

Cheers, Matt

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.

Top Kudoed Authors