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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Count and Sum of one unique value across multiple columns

TableTable

 

Hi guys,

 

To provide some context to the table above, we have an office and one person can come into the office either in the morning or the afternoon. The table above indicates who will be going into the office in the morning and who will be going in the afternoon. 

 

I would like to have a table visual on PowerBI that sums up how many times an individual will be going into the office like so: 

 

Table2Table2

 

Would appreciate your help.

 

Thanks in advance.

 

1 ACCEPTED SOLUTION
v-henryk-mstf
Community Support
Community Support

Hi @Anonymous ,

 

You can append two columns in the power query and remove the duplicate values and use the new table formed as a list. Then count the corresponding values in both columns.

vhenrykmstf_0-1637737000176.png

vhenrykmstf_1-1637737010240.png

If the problem is still not resolved, please point it out. Looking forward to your reply.


Best Regards,
Henry


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-henryk-mstf
Community Support
Community Support

Hi @Anonymous ,

 

You can append two columns in the power query and remove the duplicate values and use the new table formed as a list. Then count the corresponding values in both columns.

vhenrykmstf_0-1637737000176.png

vhenrykmstf_1-1637737010240.png

If the problem is still not resolved, please point it out. Looking forward to your reply.


Best Regards,
Henry


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous , You need create a table with all names

 

Name = distinct(union(distinct(Table[Morning]), distinct(Table[afternoon]) ))

 

then join it with both name, assume Morning join is active

 

Count(Table[Name]) + calculate(count(Table[Name]) , userealtionship( Table[afternoon], Name[Morning]) )

 

https://radacad.com/userelationship-or-role-playing-dimension-dealing-with-inactive-relationships-in-power-bi

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Thanks for your reply @amitchandak 

 

So just to confirm with you: lets say the table name of the breakdown of people going in the morning/afternoon is named "Office_Roster". I need to create a second table with the names, I named this second table 'Office_Members'.

 

Then I create the following first measure: 

 

Name = distinct(union(distinct(Office_Roster[Morning]), distinct(Office_Roster[afternoon]) ))

 

and afterwards I didnt quite understand your expression "Count(Table[Name]) + calculate(count(Table[Name]) , userealtionship( Table[afternoon], Name[Morning]) )" 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.

Top Solution Authors