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

Cannot convert value " of type Text to type Number

Hi everyone!

When I tried to convert text into number, this error showed up: Cannot convert value " of type Text to type Number. It's probably because there are some empty strings. So I tried to convert them into 0. But again, the same error showed up and I don't know why. Could you help me figure out with this? Thanks in advance.

 

Here's my dax function:

Count# = VALUE(COALESCE([Count], 0))

[Count] is the original attribute in text format.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

Please check the following results:

vtianyichmsft_0-1705991127567.png

Measure 3 = VAR _t =ADDCOLUMNS('Table',"Total",SUMX(FILTER(ALL('Table'),[planning cycle]=EARLIER([planning cycle])),[Measure 2]))
RETURN MAXX(_t,[Total])

 

An attachment for your reference. Hope it helps!

 

Best regards,
Community Support Team_ Scott Chang

 

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

17 REPLIES 17
Anonymous
Not applicable

Hi @Anonymous ,

 

Please check the following results:

vtianyichmsft_0-1705991127567.png

Measure 3 = VAR _t =ADDCOLUMNS('Table',"Total",SUMX(FILTER(ALL('Table'),[planning cycle]=EARLIER([planning cycle])),[Measure 2]))
RETURN MAXX(_t,[Total])

 

An attachment for your reference. Hope it helps!

 

Best regards,
Community Support Team_ Scott Chang

 

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

 

Anonymous
Not applicable

Hi @Anonymous ,

 

I made simple samples and you can check the results below:

vtianyichmsft_2-1705889827601.png

vtianyichmsft_3-1705889835722.png

 

 

Measure = IF(VALUE(MAX('Table'[Value]))=BLANK(),0,VALUE((MAX('Table'[Value]))))

 

 

An attachment for your reference. Hope it helps!

 

Best regards,
Community Support Team_ Scott Chang

 

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

 

Anonymous
Not applicable

Hi Scott,

Thanks.

I tried your way but still failed. Is it because my raw data has something like this? two types of blank?

skjfo_8984375_0-1705973714687.png

 

Anonymous
Not applicable

Hi @Anonymous ,

 

Try replacing blank() with ""

 

Hope it helps!

 

Best regards,
Community Support Team_ Scott Chang

 

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

Anonymous
Not applicable

it says can't compare type of number with type of text.

skjfo_8984375_0-1705975166441.png

 

Anonymous
Not applicable

Hi @Anonymous ,

 

Please try:

Measure = IF(MAX('Table'[Value])="",0,VALUE(MAX('Table'[Value])))

 

Hope it helps!

 

Best regards,
Community Support Team_ Scott Chang

Anonymous
Not applicable

Thanks it works. But how can I sum up these number by different dimension?

skjfo_8984375_0-1705979249061.png

 

Anonymous
Not applicable

Hi @Anonymous ,

 

Depends on your individual needs, for example, if you need to take the value of column A as 1 for summing, you can use the following expression:

 

Measure = CALCULATE([measure],FILTER('Table',[A]=1))

 

 

Hope it helps!

 

Best regards,
Community Support Team_ Scott Chang

 

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

Anonymous
Not applicable

what if I want to show the total count of each planning cycle?

here's my raw data:

planning cycleproduct namemeasure
19A0
19B1
20C1
20D1
20E0

I want to get summary table like this:

planning cycle

measure
191
202
Ahmedx
Super User
Super User

Measure = Count(Yourtable[Count])

or share the file to help you

Anonymous
Not applicable

Thanks for your help. I tried but failed again. and I'm sorry I'm afraid I can't share the file because of the confidentiality.

Ahmedx
Super User
Super User

pls try this

or this

 

IFERROR(VALUE([Count]),0)

 

Screenshot_1.png

Anonymous
Not applicable

Thanks. But it turned to be that Count# is different with Count, do you know why is that?

skjfo_8984375_0-1705654128021.png

 

show how you wrote the measure

Anonymous
Not applicable

skjfo_8984375_0-1705654896685.png

 

you wrote a column and you need to write your measure [Count]

write like this

Measure = IFERROR(CONVERT([Count],INTEGER),0)

Anonymous
Not applicable

But [Count] is actually a column. How can I write a measure based on a column?

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

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.