Substract Time using Select() - Duration

Hi,

I’m trying to substract two time values that are in the same column. To do so, I use Select() in order to find them. I’m doing this in a Virtual Column to find the Duration but it keeps telling me that the types are wrong. Here is the formula just in case:

IF(OR([Ingreso o Salida] = “2. Salida al descanso”, [Ingreso o Salida] = “4. Salida del trabajo”), (SELECT(JORNADA LABORAL[Hora], AND([Fecha] = [_THISROW].[Fecha], [_THISROW].[Nombre] = [Nombre], [Ingreso o Salida] = “2. Salida al descanso”))) - (SELECT(JORNADA LABORAL[Hora], AND([Fecha] = [_THISROW].[Fecha], [_THISROW].[Nombre] = [Nombre], [Ingreso o Salida] = “1. Ingreso al trabajo”))), {TIME(0)}) +

(SELECT(JORNADA LABORAL[Hora], AND([Fecha] = [_THISROW].[Fecha], [_THISROW].[Nombre] = [Nombre], [Ingreso o Salida] = “4. Salida del trabajo”))) - (SELECT(JORNADA LABORAL[Hora], AND([Fecha] = [_THISROW].[Fecha], [_THISROW].[Nombre] = [Nombre], [Ingreso o Salida] = “3. Regreso del descanso”)))

The expression is valid but its result type ‘List’ is not one of the expected types: Duration

Thanks for the help!

No worries! I solved it by adding ANY() before the SELECT().

2 Likes