The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Hi All,
I am trying to sum all the data in a column of a table where that column name is based on the row name of the table I am in, I am unable to find anything around this and was wondering if anyone had any good examples.
For context the columns are a list of names and I am trying to get a total of their "points" across a list of events.
Thanks in advance!
Solved! Go to Solution.
This example can help you.
Events table:
Event Alice Bob Charlie
Event1 10 5 8
Event2 7 3 6
Event3 4 8 9
_________________________
Participants table:
Name
Alice
Bob
Charlie
_______________________
Create a measure to sum the points for each participant across all events:
TotalPoints =
VAR ParticipantName = SELECTEDVALUE(Participants[Name])
RETURN
SUMX(
Events,
SWITCH(
ParticipantName,
"Alice", Events[Alice],
"Bob", Events[Bob],
"Charlie", Events[Charlie],
0
)
)
This example can help you.
Events table:
Event Alice Bob Charlie
Event1 10 5 8
Event2 7 3 6
Event3 4 8 9
_________________________
Participants table:
Name
Alice
Bob
Charlie
_______________________
Create a measure to sum the points for each participant across all events:
TotalPoints =
VAR ParticipantName = SELECTEDVALUE(Participants[Name])
RETURN
SUMX(
Events,
SWITCH(
ParticipantName,
"Alice", Events[Alice],
"Bob", Events[Bob],
"Charlie", Events[Charlie],
0
)
)
User | Count |
---|---|
15 | |
12 | |
8 | |
7 | |
7 |
User | Count |
---|---|
24 | |
21 | |
12 | |
10 | |
7 |