Forum Discussion
Anonymous
6 years agoNot applicable
How to use a dynamic string variable
Hi guys, Hope you can help me, i have this table: the data is not always sorted so, i am looking for the operator name where the id is the highest: this the following i was able to get ...
- Anonymous6 years ago
Hi Anonymous ,
Please try to create a calculated column with below formula to replace the original measure:
Column = VAR _topclient = CALCULATE ( MAX ( 'Well List'[Operator] ), FILTER ( ALL ( 'Well List' ), 'Well List'[WellID] = MAX ( 'Well List'[WellID] ) ) ) RETURN IF ( 'Well List'[Operator] = _topclient, 1, 0 )Best Regards
Rena
Greg_Deckler
6 years agoCommunity Champion
Anonymous - Not sure I completely understand, but perhaps this:
Measure = IF(MAX([Operator]) = [_CURRENT],1,0)
- Anonymous6 years agoNot applicable
Hi Greg_Deckler ,
Thanks for your answer, i still got the same result as 1, i know Max will be interating row by row but wondering why not recognizing the _topclient variable.
- Anonymous6 years agoNot applicable
if i just return the variable _topclient :
_CURRENT = VAR TOPWELL = MAX('Well List'[WellID]) VAR _topclient = CALCULATE(MAX('Well List'[Operator]), KEEPFILTERS( FILTER( ALL('Well List'[WellName], 'Well List'[Operator], 'Well List'[WellID]), 'Well List'[WellID] = TOPWELL))) return _topclientthe result is this:
so seems it is filtering row by row and not giving the proper result.
- Greg_Deckler6 years agoCommunity Champion
Anonymous - I'm still now 100% clear but you may need an ALL or ALLEXCEPT in there to break out of the current context of the visual/row.
- Anonymous6 years agoNot applicable
Any slightly idea where i should apply it?