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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Michaelbean21
Advocate II
Advocate II

Summarize based on two columns

Michaelbean21_0-1666023643390.png

Hi there, I am trying to get an accurate count of DIMBRANCHID's based on BILLTODIMENTITYID.

For the case above my "test" column should come back as a count of 2 as there is two rows for the same BILLTODIMENTITYID, but there is two DIMBRANCHID's associated with the BILLTODIMENTITYID.

1 ACCEPTED SOLUTION
tackytechtom
Super User
Super User

Hi @Michaelbean21 ,

 

I assume, you would like to create a calculated column which returns the DISTINCT COUNT of DIMBRANCHID (RandomAttribute1)  per BILLTODIMENTITYID (GroupingCol). Is this correct? If so, then this one down here should help you:

 

tackytechtom_1-1666027326201.png

 

TableSummarizeCol = 
VAR _groupingCol = TableGroup[GroupingCol]
RETURN
CALCULATE ( DISTINCTCOUNT ( TableGroup[RandomAttribute1] ), ALL ( TableGroup ), TableGroup[GroupingCol] = _groupingCol)

 

 

If you are only interested in the number of row appearences per group (and independently of the other attribute), then this one should work:

 

tackytechtom_0-1666027196445.png

 

 

TableSummarizeCol = 
VAR _groupingCol = TableGroup[GroupingCol]
RETURN
CALCULATE ( COUNTROWS ( TableGroup ), ALL ( TableGroup ), TableGroup[GroupingCol] = _groupingCol)

 

Let me know if this helps! If not, feel free to provide some sample data 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/

 



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

View solution in original post

1 REPLY 1
tackytechtom
Super User
Super User

Hi @Michaelbean21 ,

 

I assume, you would like to create a calculated column which returns the DISTINCT COUNT of DIMBRANCHID (RandomAttribute1)  per BILLTODIMENTITYID (GroupingCol). Is this correct? If so, then this one down here should help you:

 

tackytechtom_1-1666027326201.png

 

TableSummarizeCol = 
VAR _groupingCol = TableGroup[GroupingCol]
RETURN
CALCULATE ( DISTINCTCOUNT ( TableGroup[RandomAttribute1] ), ALL ( TableGroup ), TableGroup[GroupingCol] = _groupingCol)

 

 

If you are only interested in the number of row appearences per group (and independently of the other attribute), then this one should work:

 

tackytechtom_0-1666027196445.png

 

 

TableSummarizeCol = 
VAR _groupingCol = TableGroup[GroupingCol]
RETURN
CALCULATE ( COUNTROWS ( TableGroup ), ALL ( TableGroup ), TableGroup[GroupingCol] = _groupingCol)

 

Let me know if this helps! If not, feel free to provide some sample data 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/

 



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

Helpful resources

Announcements
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 Kudoed Authors