Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Measure doesn't working with selectedvalue

Hi, i need help!   I have the follow measure:   REAL = CALCULATE( sum(BA_DIARIO[VLR_LANCAMENTO])/1000000, LASTDATE(BA_DIARIO[DT_EXEC]) )    This one works fine and do what i need ...
  • BeaBF's avatar
    BeaBF
    2 years ago

    Anonymous Ok, it's more clear. So try with create a new calculated table:

    DC_TABLE = DISTINCT(BA_DIARIO[DC])
    you have to relate this table with BA_DIARIO and use this new table as column in the matrix.
    Then create another new table:
    DT_TABLE = DISTINCT(BA_DIARIO[DT_EXEC])
    but DON'T relate this new one with BA_DIARIO.
    Then calculate measure like:
    Sum Switch =
    VAR BN6 = CALCULATE(SUM(BA_DIARIO[VLR_LANCAMENTO]) / 1000000, DC_TABLE[BA_DIARIO_DC] = "BN 6 + 6")
    VAR MAXDTEXEC = MAX(DT_TABLE[DT_EXEC])
    VAR DCMAXEXEC = CALCULATE(SUM(BA_DIARIO[VLR_LANCAMENTO]) /1000000, BA_DIARIO[DT_EXEC] = MAXDTEXEC, ALL(DC_TABLE))
    VAR CALC   =
    IF(
    SELECTEDVALUE (DC_TABLE[BA_DIARIO_DC] ) = "△ REAL X BN", BN6 - DCMAXEXEC, SUM(BA_DIARIO[VLR_LANCAMENTO]) / 1000000)

    RETURN CALC
     
    and you achieve the output:

     

     

    BBF