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.

0 7 194
7 REPLIES 7

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.



You can maybe use

DECIMAL( [pD (Pro)] ) > 0

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

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:

<<IF([pH (Pro)] = 0, โ€œNAโ€, [pH (Pro)]) >>

Top Labels in this Space