Forum Discussion

MTrullàs's avatar
MTrullàs
Helper III
4 years ago
Solved

Percentile

Hi everybody!   I want to calculate column D in this example with DAX.     I try to do it with this code, but I have some mistakes in the results.     Percentil Fábrica = VAR Totalco...
  • AlB's avatar
    4 years ago

    MTrullàs 

    Ok. That is different from what I had understood earlier.  See it all at work in the attached file:

     

     

    NewMeasure = 
    VAR total_ = CALCULATE ( COUNT ( Table1[Estancia Fábrica] ), ALL ( Table1 ) )
    VAR currentEst_ = SELECTEDVALUE ( Table1[Estancia Fábrica], total_ )
    VAR cumul_ =
        CALCULATE (
            COUNT ( Table1[Estancia Fábrica] ),
            Table1[Estancia Fábrica] <= currentEst_,
            ALL ( Table1 )
        )
    RETURN
    DIVIDE ( cumul_, total_ )

     

     

    Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

    Contact me privately for support with any larger-scale BI needs, tutoring, etc.