Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Measure doesn't return total

Hi Everyone!

I have this measure, in which it looks for every previous value, e if it's equal to the actual value, it returns 1, otherwise 0. Nevertheless, it returns values by date, but doesn't return total in any visual. What could it be?

Count.Congelamento =
VAR EarlierEntryOfNomeDeOrigem =
    CALCULATE(
        MAX(fminuto[Timestamp]),
        FILTER(
            ALL(fminuto),
            fminuto[Nome da Origem]=SELECTEDVALUE(fminuto[Nome da Origem])
            && fminuto[Timestamp]<MAX(fminuto[Timestamp])
        )
    )

VAR EarlierEntryOfVazao = CALCULATE(
    SELECTEDVALUE(fminuto[Vazão],"no value"),
    FILTER(
        ALL(fminuto),
        fminuto[Nome da Origem]=SELECTEDVALUE(fminuto[Nome da Origem])
        && fminuto[Timestamp] = EarlierEntryOfNomeDeOrigem
    )
)

VAR Congela = IF(EarlierEntryOfVazao=SELECTEDVALUE(fminuto[Vazão],"no value"), 1, 0)

VAR Tabela = ADDCOLUMNS(SUMMARIZE(fminuto, fminuto[Nome da Origem], fminuto[Timestamp]), "Freeze", Congela)

RETURN
COUNTROWS(FILTER(Tabela, Congela=1))

 


 



  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Anonymous ,

    Please check the first two variables (EarlierEntryOfNomeDeOrigem, EarlierEntryOfVazao), which I suspect return blank values when you use this measure alone.

    SELECTEDVALUE function

     

    If they both return null values, try adding the complete filtering context to the measure in the visual. Please try like:

    Measure = SUMX(VALUES('Table'[Data]),[Count.Congelamento])

     

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly -- How to provide sample data

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    Please check the first two variables (EarlierEntryOfNomeDeOrigem, EarlierEntryOfVazao), which I suspect return blank values when you use this measure alone.

    SELECTEDVALUE function

     

    If they both return null values, try adding the complete filtering context to the measure in the visual. Please try like:

    Measure = SUMX(VALUES('Table'[Data]),[Count.Congelamento])

     

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly -- How to provide sample data

    • Anonymous's avatar
      Anonymous
      Not applicable

      Anonymous Thank you very much!