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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Sum column in measure, ignoring other columns

Dear all,

 

I have a column in my table which i want to be summed on a unique row, but it needs to ignore the 'code' column. So when summing instantly it returns 10. but I need it to be two, since City is changing as well, but this needs to be taken into account.

 

IDTYPECodeCityType_IDYearSum
AR!625NYR1-A20231
AR!545NYR1-A20231
AR!126NYR1-A20231
AR!120NYR1-A20231
AR!116NYR1-A20231
AR!625LAR1-A20231
AR!545LAR1-A20231
AR!126LAR1-A20231
AR!120LAR1-A20231
AR!116LAR1-A20231
1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Table:

b1.png

 

You may create a measure as below.

Sum = 
COUNTROWS(
    SUMMARIZE(
        'Table',
        'Table'[ID],
        'Table'[City]
    )
)

 

Result:

b2.png

 

Best Regards

Allan

 

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

3 REPLIES 3
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Table:

b1.png

 

You may create a measure as below.

Sum = 
COUNTROWS(
    SUMMARIZE(
        'Table',
        'Table'[ID],
        'Table'[City]
    )
)

 

Result:

b2.png

 

Best Regards

Allan

 

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

amitchandak
Super User
Super User

@Anonymous , is it not, distinct count of the city ?

 

a new measure

distinctcount(Table[City])

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

the result is 2 yes, but lets say my table in real is much longer with different ID in same city

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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