Forum Discussion
Anonymous
2 years agoNot applicable
Dax Returned statement Help
ok so the top had of my DAx is running fine as it should but then I get down to the return part I am running into issues. I am trying to have it print off a 2,1,-1or -2 to based off what it get from ...
- 2 years ago
Hi Anonymous ,
You can refer to below method.
RETURN = VAR LatestStatus = 'Table'[Latest Status] VAR SplitPositions = UNION( SELECTCOLUMNS({0},"Position",[Value]), DISTINCT(FILTER(SELECTCOLUMNS(GENERATESERIES(1,LEN(LatestStatus )),"Position",FIND(",",LatestStatus ,[Value],BLANK())),[Position]<>BLANK())), {LEN(LatestStatus )+1} ) VAR SplitPosition_AddIndex = ADDCOLUMNS(SplitPositions,"Index",RANKX(SplitPositions,[Position],,1)) VAR NumList = SELECTCOLUMNS( GENERATESERIES(1,COUNTROWS(SplitPositions)-1), "Num", VAR Start_ = SUMMARIZE(FILTER(SplitPosition_AddIndex,[Index]=[Value]),[Position])+1 VAR End_ = SUMMARIZE(FILTER(SplitPosition_AddIndex,[Index]=[Value]+1),[Position]) RETURN MID(LatestStatus ,Start_,End_-Start_)*1 ) RETURN MAXX(NumList,[Num])Demo - Dax Returned statement Help.pbix
Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !
Thank you~
Anonymous
2 years agoNot applicable
So sorryfor not responding, I started working on something else and just did not get an update notification from my posted question so I'll tries methods now and get back to everyone who responded to help.