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
Anonymous
Not applicable

Sumif on multiple tables

I have 2 tables and I want to do a sumif on one table referencing the other. 

In excel I did it as =SUMIF(D4:D9,F4,C4:C9). 

In PowerBI, I thought it would be this, but is says SUMX cannot work with calues of type String. 

Capacity = sumx(filter(CapacityTable,CapacityTable[Graph]=TotalsTable[Graph]),D1D_Capacity[Existing Operating Capacity])

astarrett_3-1708727585132.png

Any ideas? Thanks in advance.  

 

4 ACCEPTED SOLUTIONS
StrategicSavvy
Resolver II
Resolver II

Hi, 

 

If you want to get aggregated table you need to create new table in PowerBI and try use this code for summarizing your data from Capacity Table:

 

Totals Table =
SUMMARIZE ( 'Capacity Table' ,
'Capacity Table'[Graph],
"Capacity",
SUMX('Capacity Table',
'Capacity Table'[Capacity]
)
)

 

 

Hope it helps!

View solution in original post

Daniel29195
Super User
Super User

@Anonymous 

if this error is showing, cannot work with calues of type String.  then power bi is reading your capacity as text instaed of numbers . convert the datatype of your columns you are aggregating to number and try your measure.  this error should disappear.

 

let me know if this helps .. 

 

 

If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠

View solution in original post

Ashish_Mathur
Super User
Super User

Hi,

If you want a Power Query solution, you can simply use the Group By feature and then use SUM as the aggregation function.  If you want a measure solution, you just need to drag Graph to the visual and write this measure

Measure = sum(D1D_Capacity[Existing Operating Capacity])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

Anonymous
Not applicable

Hi @Anonymous ,

You can first create a relationship between two tables:

vjunyantmsft_3-1708930830399.png
Then you only need to use this DAX to create a measure:

 

Measure = SUM('Table'[Capacity])

 

And put "Graph" and Measure into the table visual, the final output is as below:

vjunyantmsft_2-1708930735023.png

Or you can use this DAX to create a new column in Table(2):

 

Column = 
CALCULATE(
    SUM('Table'[Capacity]),
    FILTER(
        'Table',
        'Table'[Graph] = 'Table (2)'[Graph]
    )
)

 

The final output is as below:

vjunyantmsft_4-1708930977722.png

 

Best Regards,
Dino Tao
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
Anonymous
Not applicable

Hi @Anonymous ,

You can first create a relationship between two tables:

vjunyantmsft_3-1708930830399.png
Then you only need to use this DAX to create a measure:

 

Measure = SUM('Table'[Capacity])

 

And put "Graph" and Measure into the table visual, the final output is as below:

vjunyantmsft_2-1708930735023.png

Or you can use this DAX to create a new column in Table(2):

 

Column = 
CALCULATE(
    SUM('Table'[Capacity]),
    FILTER(
        'Table',
        'Table'[Graph] = 'Table (2)'[Graph]
    )
)

 

The final output is as below:

vjunyantmsft_4-1708930977722.png

 

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

Ashish_Mathur
Super User
Super User

Hi,

If you want a Power Query solution, you can simply use the Group By feature and then use SUM as the aggregation function.  If you want a measure solution, you just need to drag Graph to the visual and write this measure

Measure = sum(D1D_Capacity[Existing Operating Capacity])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Daniel29195
Super User
Super User

@Anonymous 

if this error is showing, cannot work with calues of type String.  then power bi is reading your capacity as text instaed of numbers . convert the datatype of your columns you are aggregating to number and try your measure.  this error should disappear.

 

let me know if this helps .. 

 

 

If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠

StrategicSavvy
Resolver II
Resolver II

Hi, 

 

If you want to get aggregated table you need to create new table in PowerBI and try use this code for summarizing your data from Capacity Table:

 

Totals Table =
SUMMARIZE ( 'Capacity Table' ,
'Capacity Table'[Graph],
"Capacity",
SUMX('Capacity Table',
'Capacity Table'[Capacity]
)
)

 

 

Hope it helps!

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.

Top Solution Authors