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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Malo
Regular Visitor

operand error for sum with directquery

Dear all,
I've an issue with the last version of Power BI (2.84.981.0 64-bit (august 2020)). I've opened an old report, last modified on 08th June 2020 (it work well with no problem), and I've added a new table from my database (the same of the report) using SQL server and directquery, no problems in this operation. I've converted the data type of a column from nvarchar to integer in the main page and then I've created a simple measure (SUM (table_name [column_name]), but when I've tried to create a visual object is occurred this error "OPERAND DATA TYPE NVARCHAR IS INVALID FOR SUM OPERATOR..". How I can solve the problem? I know that with directquery I can not change data type in power query mode, but I don't want to shape data before import. 

 

Thanks for your help

1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @Malo ,

 

You could create a measure using VALUE() function to convert text to number.

Then use SUMX() function to calculate the sum of measure.

Measure = VALUE(SELECTEDVALUE('Table'[Column1]))

Measure 2 = SUMX('Table',[Measure])

 
Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

4 REPLIES 4
v-jayw-msft
Community Support
Community Support

Hi @Malo ,

 

You could create a measure using VALUE() function to convert text to number.

Then use SUMX() function to calculate the sum of measure.

Measure = VALUE(SELECTEDVALUE('Table'[Column1]))

Measure 2 = SUMX('Table',[Measure])

 
Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

Thanks for the solution. It work well

amitchandak
Super User
Super User

@Malo , please check the data type of the column at the source. It showing it as nvarchar . So you can only have Count /min/max .

Try sum on some numeric column it should work

Thanks for your suggestion

If I try to repeat the same operation on a table already imported, I've no problem. For this reason I've tried to re import like a new table, one I've already imported and I've repeated the same operations, but this time nothing work as in the past.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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