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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
GB74
Regular Visitor

Count number of times all names appear in multiple columns

I have a table that contains the following columns (plus some others):

GB74_4-1724992117896.png

 

I need to produce a report that displays how many meetings each person attended each week, including the ones where they were the host. Something like this:

GB74_5-1724992404692.png

I know how to sumarise for the week but I can't work out how to count where the name can appear in any of the 4 columns (Host, Attendee #1, 2 or 3).

I can't just create a separate column per person or something like that as in my real life scenario, I have too many people to include and we are currently experiencing high staff turnover, so I can't be be constantly editing the formulas/columns when a person leaves or a new person starts. 

Any assistance would be greatly appreciated.

5 REPLIES 5
v-junyant-msft
Community Support
Community Support

Hi @GB74 ,

If you are ok with data structure changes, then I think the Idrissshatila's approach should be the easiest.
But if you need to keep the current data structure, that might be tricky. I created some sample data myself:

vjunyantmsft_0-1725246154089.png

And I added such a table Week (I'm not sure if this is convenient for you, but it would be much simpler to have such a table):

vjunyantmsft_1-1725246215426.png

Then use this DAX to create a calculated column in Table Week:

ParticipationCount = 
VAR WeekStart = [Week Beginning]
VAR WeekEnd = WeekStart + 7
VAR _People = [People]
RETURN
    CALCULATE (
        COUNTROWS (
            FILTER (
                'Record',
                'Record'[Meeting Date] >= WeekStart &&
                'Record'[Meeting Date] < WeekEnd &&
                (
                    'Record'[Meeting Host] = _People ||
                    'Record'[Attendee #1] = _People ||
                    'Record'[Attendee #2] = _People ||
                    'Record'[Attendee #3] = _People
                )
            )
        )
    )

And the final output is as below:

vjunyantmsft_2-1725246297589.png


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

Idrissshatila
Super User
Super User

Hello @GB74 ,

 

the only way for this to work is to unpivot the columns that the names are one column and another column is attendee type so that you can count them.

 

so you go into Power query, click on the date column and then click on transfor tab and then upivot other columns

Idrissshatila_0-1724994653686.png


the result would be like this

Idrissshatila_1-1724994687220.png

then filter out the blank records

Idrissshatila_2-1724994800710.png


the final result

Idrissshatila_3-1724994826254.png

Lso I attached the file I did this on so you can check it.



Did I answer your question? Mark my post as a solution! Appreciate your Kudos
Follow me on LinkedIn linkedIn
Vote for my Community Mobile App Idea

Proud to be a Super User!




Thank you for the info Idrisshatila.
I'll give it a try, but I'm not sure if that will work for me as I believe the data needs to be presented the original format to produce a number of other reports within the same app.

vicky_
Super User
Super User

I am going to assume that you already have the weekly date table + a table of all your Staff (called StaffName below). You can try adapt the following:

Meetings Attended = 
var AllStaffMeeting = UNION(VALUES(Table[Host]), VALUES(Table[attendee #1]), VALUES(Table[attendee #2]), VALUES(Table[attendee #3])), //... etc for however many columns you have

RETURN COUNTROWS(FILTER(AllStaffMeeting, [Host] = SELECTEDVALUE(StaffName[Staff])))

The measure would go in the values section of a matrix table, with the Users in the rows and the Week Start Date in the Columns.

 This solution is not ideal for when you have a lot of columns, but the only other solution I see is to change the structure of your data completely - i.e you would have something like: 

Staff Meeting Date Role

Bill

01/01/2024 Host
Bill 05/01/2024 Attendee
Fred 05/01/2024 Attendee
GB74
Regular Visitor

Thanks vicky_, I'll give that a try. 
I'm not keen on changing the structure of the data as there are other reports within the same app that I believe will need the data to be in the original format.

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!

November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.