Placing text in a decimal column

Hello All,
I am trying to place a “text” value in “decimal” column with a IF expresión but I am getting an error.

Expresion:

IF((SUM(SELECT(registros[pH], AND([_THISROW].[Punto de Muestreo]=[Punto de Muestreo],[Hora Fecha Inicio]>=[_THISROW].[Rango Fecha Inicio],[Hora Fecha Final]<=[_THISROW].[Rango Fecha Final]))) > 0), AVERAGE(SELECT(registros[pH], AND([_THISROW].[Punto de Muestreo]=[Punto de Muestreo],[Hora Fecha Inicio]>=[_THISROW].[Rango Fecha Inicio],[Hora Fecha Final]<=[_THISROW].[Rango Fecha Final]))), “NA”)

Error:

Value ‘NA’ in field ‘pH (Pro)’ cannot be converted to type ‘Decimal’.

Any insight would be appreciated.

PD. I tried set the column type to “TEXT” but it generates another issue:
does not work with the “Show_If” expression:

[pH (Pro)] > 0

You can’t put text values into a Number or Decimal column.



Admin_Agrotec:

column type to “TEXT” but it generates another issue:> does not work with the “Show_If” expression:> > > [pH (Pro)] > 0

You can maybe use

DECIMAL( [pD (Pro)] ) > 0

1 Like

Thanks @Marc_Dillon , this worked. How would I set it to 2 decimal places?

Are you asking how to validate a Decimal value in a Text column to 2 decimal places?

Yes

ok.

First, I think you’re going to keep running into issues by putting decimal values in a text column, so I don’t really recommend that you continue with this.

But if you insist, perhaps this:

Valid_If = 

LEN( INDEX( SPLIT( [_THIS] , "." )  ,2 ) = 2

1 Like

Thanks again, @Marc_Dillon , I took your advise. The whole topic arose with reporting “0” which after your feedback I decided to leave things how they where and solved it at the report level:

<

2 Likes