Forum Discussion
Searching a Column to Return Value
- 6 years ago
caruso1058 , do you date column. Because all these columns will not lead to max mix etc.
as of now create index column
https://stackoverflow.com/questions/45715963/creating-an-index-column-for-power-bi
and try like
if([Index] = maxx(filter(table,[PN_Base]=earlier([PN_Base])),[index]),"Production", "Development")
The ideal would be a date. in place of index , as index it orde rin which got data in power bi
- 6 years ago
This is one way to do this in a calculated column expression. Note that you can choose to return any of the last 3 variables for different results (for example, the latest version, Dev vs Prod, or It's the last T or F).
Latest Version = VAR thisversion = Parts[PN_Suffix] VAR latestproduction = CALCULATE ( MAX ( Parts[PN_Suffix] ), ALLEXCEPT ( Parts, Parts[PN_Base] ), FILTER ( ALL ( Parts[PN_Suffix] ), VALUE ( Parts[PN_Suffix] ) < 900 ) ) VAR latestdev = CALCULATE ( MAX ( Parts[PN_Suffix] ), ALLEXCEPT ( Parts, Parts[PN_Base] ), FILTER ( ALL ( Parts[PN_Suffix] ), VALUE ( Parts[PN_Suffix] ) > 900 ) ) VAR latest = IF ( ISBLANK ( latestproduction ), latestdev, latestproduction ) VAR islatest = thisversion = latest VAR prodordev = IF ( ISBLANK ( latestproduction ), "Development", "Production" ) RETURN latestIf this works for you, mark it as the solution. Praise is also appreciated. Please let me know if you don't.
Best regards
Pat
This is one way to do this in a calculated column expression. Note that you can choose to return any of the last 3 variables for different results (for example, the latest version, Dev vs Prod, or It's the last T or F).
Latest Version =
VAR thisversion = Parts[PN_Suffix]
VAR latestproduction =
CALCULATE (
MAX ( Parts[PN_Suffix] ),
ALLEXCEPT ( Parts, Parts[PN_Base] ),
FILTER ( ALL ( Parts[PN_Suffix] ), VALUE ( Parts[PN_Suffix] ) < 900 )
)
VAR latestdev =
CALCULATE (
MAX ( Parts[PN_Suffix] ),
ALLEXCEPT ( Parts, Parts[PN_Base] ),
FILTER ( ALL ( Parts[PN_Suffix] ), VALUE ( Parts[PN_Suffix] ) > 900 )
)
VAR latest =
IF ( ISBLANK ( latestproduction ), latestdev, latestproduction )
VAR islatest = thisversion = latest
VAR prodordev =
IF ( ISBLANK ( latestproduction ), "Development", "Production" )
RETURN
latest
If this works for you, mark it as the solution. Praise is also appreciated. Please let me know if you don't.
Best regards
Pat
- caruso10586 years ago
Microsoft Employee
Wow mahoneypat ,
This is beautiful and works perfectly. I can only hope that my skills are as a savy as this one day!
Thanks a bunch!