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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
Anam
Regular Visitor

String Value in Calculating Measures

Hey, I'm trying to calculate the sum of sales by using the DAX measure function. However, when I try to plot this measure to a visual like a bar chart, it gives an error and says this sum function cannot work for values of type String. What does it mean by type string value? How do I solve this?

 

3 REPLIES 3
Anonymous
Not applicable

You can use MAX function. It will do like this: 

 

Category_Measure = MAX(TableName[Category])

 

It is not the best solution, but for some situations it is possible to do 
As a result you will get measure with categories as a strings. It should be the answer to your question

v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Anam,

 

Have you resolved your problem? If so, would you please mark the helpful reply as an answer or share your solution so that it can benefit more users? If you still have any question, please feel free to ask.

 

Thanks,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
TomMartens
Super User
Super User

Hey,

 

this is typically happen, if the data type of the column you are using in your SUM(...) function is not a numeric one.

 

To change this, most of the times it's sufficient to go to the model ribbon

Data Moedeling.png

Mark the column in the fields pane and change the data type.

Be aware of the fact, that if you change the data type it sometimes can also affect your visuals, this is due to the default, that numeric columns are treated as continuous variables on axis. This can of course can also be changed very easily. 

 

Sometimes it could be a little harder, due to the fact that a data quality issue sneaked into your data model and this issue implicity determined the initial data type of the column.

 

Hope this helps



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

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.