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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Summarized Table - Total By Column

Hi

I  need help to calculate (Total By Company) in my summary table , below is the code for the summarized table :

 

 

 

Summary Table = 
SUMMARIZE('Table1',
'Table1'[Company],
'Table1'[Type],
"TotalEmp",
DISTINCTCOUNT('Table1'[UserID])
)

 

 

 

 

below is the result of the above code :

CompanyTypeTotalEmp
ABCA15
XYZA23
ABCA34
XYZA410

 

The result I am looking for :

CompanyDivisionTotalEmpTotal By Company
ABCA159
XYZA2313
ABCA349
XYZA41013

 

Thanks

1 ACCEPTED SOLUTION
bcdobbs
Community Champion
Community Champion

You want to do something like this:

Summary Table = 
ADDCOLUMNS (
    SUMMARIZE(
        'Table1',
        'Table1'[Company],
        'Table1'[Type]
    ),
    "Emp", CALCULATE ( DISTINCTCOUNT('Table1'[UserID]) ),
    "Total Company Emp ", CALCULATE ( DISTINCTCOUNT('Table1'[UserID]), ALLEXCEPT ( Table1, Table1[Company] ) )
)

 

You'll notice I've used SUMMARIZE in combination with ADDCOLUMNS rather than letting SUMMARIZE do the aggregation. Have a read of All The Secrets of Summarize 



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

View solution in original post

6 REPLIES 6
bcdobbs
Community Champion
Community Champion

You want to do something like this:

Summary Table = 
ADDCOLUMNS (
    SUMMARIZE(
        'Table1',
        'Table1'[Company],
        'Table1'[Type]
    ),
    "Emp", CALCULATE ( DISTINCTCOUNT('Table1'[UserID]) ),
    "Total Company Emp ", CALCULATE ( DISTINCTCOUNT('Table1'[UserID]), ALLEXCEPT ( Table1, Table1[Company] ) )
)

 

You'll notice I've used SUMMARIZE in combination with ADDCOLUMNS rather than letting SUMMARIZE do the aggregation. Have a read of All The Secrets of Summarize 



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
Anonymous
Not applicable

Perfect , thanks for the support .

ALLUREAN
Solution Sage
Solution Sage

Hi, @Anonymous 

 

Try this:

Summary Table =
SUMMARIZE('Table1',
'Table1'[Company],
"TotalEmp",
DISTINCTCOUNT('Table1'[UserID])
)

 

 




Did I answer your question? Mark my post as a solution!


https://allure-analytics.com/
https://www.youtube.com/channel/UCndD_QZVNB_JWYLEmP6KrpA
https://www.linkedin.com/company/77757292/

Proud to be a Super User!




Anonymous
Not applicable

This not what i am looking for , the column (Type) is missing .. I want the (Total By Company) grouped based on the company with (type) coulmn present in the table . 

try using measure like:

Total By Company = CALCULATE(COUNT('Table1'[UserID]), ALLEXCEPT('Table1', 'Table1'[Company]))
 
Check this:
 
 
 
 



Did I answer your question? Mark my post as a solution!


https://allure-analytics.com/
https://www.youtube.com/channel/UCndD_QZVNB_JWYLEmP6KrpA
https://www.linkedin.com/company/77757292/

Proud to be a Super User!




I think my suggestion does what you need. 



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.