Forum Discussion
sridharpolina
Helper I
4 years agoCreating 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...
- Anonymous4 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 _isPBest 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
sridharpolina
Helper I
4 years agoThanks for all your help but I need a calculated column as an output since I need to use that column in a slicer. I tried to rank using the DAX code below but its not giving me the right output. Can you modify that query to reflect the state so I could get the desired output as a calculated column
_Rank_P =
VAR _rank =
RANKX ( FILTER ( ALL ( 'Table' ), OR(('Table'[Flg] = "P"),Table[State]=SELECTEDVALUE(Table[State]))), 'Table'[AsOfDate],, DESC, DENSE )
VAR _isP =
IF ( 'Schedules'[Flg] = "P" , _rank, BLANK () )
RETURN
_isP
Anonymous
4 years agoNot applicable
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