Forum Discussion

sridharpolina's avatar
4 years ago
Solved

Creating a calculated column for the latest and previous date based on a column and a dynamic select

I created a version of the column with the help of the community where the calaculation of the latest and previous date are based on another column but I need to incorporate an additional column to t...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi sridharpolina ,

    Please change the measure to a column.

    Column = 
    var _rankx=RANKX(filter(ALLSELECTED('Table'),'Table'[State]=EARLIER('Table'[State])),'Table'[AsOfDate],,DESC,Dense)
    RETURN 
    IF(_rankx=1,"Latest Runtime",IF(_rankx=2,"Previous Runtime",FORMAT(('Table'[AsOfDate]),"General Date")))
    _Rank_P = 
    VAR _rank =
       RANKX ( FILTER  ( 'Table' , OR(('Table'[Flg] = "P"),Table[State]=EARLIER(Table[State]))), 'Table'[AsOfDate],, DESC, DENSE )
    VAR _isP =
        IF ( 'Schedules'[Flg] = "P" , _rank, BLANK () ) 
    RETURN
        _isP

     

    Best Regards

    Community Support Team _ Polly

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly