1
votes

I have a table on power bi which have counter column:

enter image description here

Over this column I have to make some sums, which I'm trying as follow:

sum(my_table[contador])

But I get an error that sum operator does not allow string values. Hence I tried to cast it this way:

sum(INT(my_table[contador]))

But now I get an error that SUM only acepts columns as arguments. How can I cast each value keeping the column?

EDIT:

I have also tried to use the query editor, but it seems this solution is not compatible with DirectQuery Mode

enter image description here

2

2 Answers

1
votes

The best way is to cast the column type to Whole Number in the Query Editor when you are loading the data: enter image description here

Or you can assign a new type to the column after loading the data in the Modeling tab: enter image description here

Will this be ok for you? Or for some reason you need the column to be Text?

0
votes

If you can't get the column converted, you can use an iterator sum instead to allow the use of VALUE.

SUMX(my_table, VALUE(my_table[contador]))