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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Using summarize gives wrong value

Hi everyone,


I am having some issues with the Summarize function as it is not giving the correct value for a specific measure. I'll explain below.

I have a sample HR table where a person has one row/record per month.

I have the following calculation:

MyCalculation = COUNTX(
                FILTER(
                    SUMMARIZE('Sample data';'Sample data'[userID];
                    "Leave";SUM('Sample data'[leaveDays]);
                    "UnitChange";CALCULATE(DISTINCTCOUNT('Sample data'[Unit]);ALL('Sample data'[Unit])));
                [Leave]<=2 && [UnitChange]<2);
            [Leave])

The bolded part above is supposed to count how many Units a userID has belonged to(as per the summarize function). 

However, upon inspection all userIDs get assigned value 1 on UnitChange(1 is the least they can have) even in cases where they actually have a higher number.

So Summarize does not seem to calculate the correct value for the UnitChange measure.. 
I've been stuck on this for a while now.. Anyone have an idea? 
Thank you

1 ACCEPTED SOLUTION
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

The below article explains how Summarize works, the common practice is to use summarize for group by and then ADDCOLUMN() for Aggregations.

https://www.sqlbi.com/articles/all-the-secrets-of-summarize/

 

Regards,
Mariusz

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

2 REPLIES 2
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

The below article explains how Summarize works, the common practice is to use summarize for group by and then ADDCOLUMN() for Aggregations.

https://www.sqlbi.com/articles/all-the-secrets-of-summarize/

 

Regards,
Mariusz

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

Anonymous
Not applicable

Thank you for the article!
It makes perfect sense now.

Although it seems Summarizedcolumns seems to be amore efficient way to use this.
Will look into it

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.