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
Caiz
Frequent Visitor

Using Measures: The function SUM cannot work with values of type String

Hi there,

 

I have two excel tables I've imported with the same columns to show as a table for each within Power BI. I have replicated code for a Measure that will display the variance between two columns values. It works for my Revenue table, however doesn't work for NEW Expenditure.

 

I get the error "The function SUM cannot work with values of type String". 

 

Revenue:

Month Variance = IFERROR(
  (SUM(Revenue[Actual Month]) - SUM(Revenue[Budget Month]))/SUM(Revenue[Budget Month]), 0)

 

New Expenditure:

Month Variance = IFERROR(
  (SUM('NEW Expenditure'[Actual Month]) - SUM('NEW Expenditure'[Budget Month]))/SUM('NEW Expenditure'[Budget Month]), 0)

 

I have also observed that with the Expenditure measure, I can only reference the table with quotation marks whereas the other one doesn't require the quotation marks which is odd.

 

Could someone please help me with this?

1 ACCEPTED SOLUTION
dedelman_clng
Community Champion
Community Champion

Hi @Caiz -

 

Check the data types in "Transform Data" for your NEW Expenditure table. Likely one or more of the columns is being treated as "Text" or "Any" because some value prevented it from being recognized as a number all the way down.

 

The ' ' around NEW Expenditure is because of the space in the table name. If you named it New_Expenditure or NewExpenditure it would not have the ' '.

 

Hope this helps

David

View solution in original post

2 REPLIES 2
dedelman_clng
Community Champion
Community Champion

Hi @Caiz -

 

Check the data types in "Transform Data" for your NEW Expenditure table. Likely one or more of the columns is being treated as "Text" or "Any" because some value prevented it from being recognized as a number all the way down.

 

The ' ' around NEW Expenditure is because of the space in the table name. If you named it New_Expenditure or NewExpenditure it would not have the ' '.

 

Hope this helps

David

mahoneypat
Microsoft Employee
Microsoft Employee

Sounds like one of your columns is type text instead of numeric.  Check/fix that in the query editor.

 

Also, if your two tables have the same columns, you should likely Append them together in the query editor.  Add a fixed column before the append that you can use in a slicer, visual, etc..  You would then disable load on the source tables, so you only have the one table in your model (vs. those three).

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
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.