Forum Discussion

Jean_Ferro's avatar
Jean_Ferro
Helper I
1 year ago
Solved

Error with measure using numerical parameter in the calculation

Hello everyone!

I created a numeric parameter and I'm trying to use it in this measurement as part of the calculation:

measureTest =
VAR filtroCobertura = 'Filtro Cobertura'[Valor Filtro Cobertura]
RETURN
SUMX(
    fCoberturaEstoque90Dias,
    IF(fCoberturaEstoque90Dias[COBERTURA_FILTRO] = 999999, fCoberturaEstoque90Dias[CSTBRUTO_ATUAL],
    (fCoberturaEstoque90Dias[CSTBRUTO_ATUAL]/fCoberturaEstoque90Dias[COBERTURA])*(fCoberturaEstoque90Dias[COBERTURA]-filtroCobertura)
    )
)


I want to use this parameter as a fixed value passed by the user to recalculate the measurement dynamically.

But I'm getting this error:

 



I've tried a lot but I gave up and came here to ask for help.

Thank you in advance for your attention!

  • I found the problem.

    My product dimension table had an error that caused the many-to-many connection with the fact table.

    By solving the problem and leaving the 1-to-many connection, the measurement no longer had errors.

    Thanks for your help.

2 Replies

  • Hi Jean_Ferro  - as per above snap, the column mentioned in the error ([COBERTURA_FILTRO] or other columns in the formula) may not have a proper relationship with other tables in your model, or the column itself might not exist in the context of the measure.

    can you modify the above, 

    measureTest =
    VAR filtroCobertura = SELECTEDVALUE('Filtro Cobertura'[Valor Filtro Cobertura], 0)
    RETURN
    SUMX(
    fCoberturaEstoque90Dias,
    IF(
    fCoberturaEstoque90Dias[COBERTURA_FILTRO] = 999999,
    fCoberturaEstoque90Dias[CSTBRUTO_ATUAL],
    (fCoberturaEstoque90Dias[CSTBRUTO_ATUAL] / fCoberturaEstoque90Dias[COBERTURA]) *
    (fCoberturaEstoque90Dias[COBERTURA] - filtroCobertura)
    )
    )

     

    check this and let know , if still issue exist please share sample data file will check

  • I found the problem.

    My product dimension table had an error that caused the many-to-many connection with the fact table.

    By solving the problem and leaving the 1-to-many connection, the measurement no longer had errors.

    Thanks for your help.