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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
PShpav
Regular Visitor

Need help finding records in a column matched with more than one other record in a different column

I'm relatively new to DAX and I need to find some kind of COUNTIFS-like formula to produce a column that will help me find if one participant in the Full_Names column has attended more than one series in the Topic column. Basically, I want to replicate something like what you see in the far right column you see below. 

 

dataupondatadotdotdot.PNG

 

Any help with respect to this question would be greatly appreciated. Thanks!

1 ACCEPTED SOLUTION
dax
Community Support
Community Support

Hi @PShpav , 

You could try below expression in measure or calculated column 

Column = CALCULATE(DISTINCTCOUNT(t2[Topic]), ALLEXCEPT(t2,t2[Full_Name]))

749.PNG

Best Regards,
Zoe Zhi

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

4 REPLIES 4
edhans
Super User
Super User

Hi @PShpav - I created this in Power Query when you first bring the data in. It gets treated as a native column and can perform better than a calculated column in DAX. The other option is a measure as @dax suggested. It turns this:

2020-06-09 19_37_15-Untitled - Power Query Editor.png

Into this:

2020-06-09 19_37_35-Untitled - Power Query Editor.png

This is the code I used. It was a simple Group By using the Count of Distinct values.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCshMzMtX0lHySk1LU4rViVYKy8zPycwDivgmFmWDRWBKgkuLE/NQ1SCEQopKcwtSS5D1oauKBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Topic = _t, Name = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Topic", type text}, {"Name", type text}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Name"}, {{"Count of Topics", each Table.RowCount(Table.Distinct(_)), type number}, {"All Rows", each _, type table [Topic=text, Name=text]}}),
    #"Expanded All Rows" = Table.ExpandTableColumn(#"Grouped Rows", "All Rows", {"Topic"}, {"Topic"}),
    #"Reordered Columns" = Table.ReorderColumns(#"Expanded All Rows",{"Topic", "Name", "Count of Topics"})
in
    #"Reordered Columns"

1) In Power Query, select New Source, then Blank Query
2) On the Home ribbon, select "Advanced Editor" button
3) Remove everything you see, then paste the M code I've given you in that box.
4) Press Done
5) See this article if you need help using this M code in your model.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Thank you for taking the time to work on this! Yours is not quite the solution I was looking for but it certainly is good to know that Power BI has such an advanced Power Query feature. I will keep your solution in mind for future needs. 🙂

dax
Community Support
Community Support

Hi @PShpav , 

You could try below expression in measure or calculated column 

Column = CALCULATE(DISTINCTCOUNT(t2[Topic]), ALLEXCEPT(t2,t2[Full_Name]))

749.PNG

Best Regards,
Zoe Zhi

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

 

 

PShpav
Regular Visitor

Thanks so much! You helped a great deal with what I needed to accomplish!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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