Forum Discussion
How to use a dynamic string variable
- 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
Any slightly idea where i should apply it?
Hi Anonymous ,
Please try to update the formula of measure as below:
Flag =
VAR TOPWELL =
CALCULATE ( MAX ( 'Well List'[WellID] ), ALL ( 'Well List' ) )
VAR _topclient =
CALCULATE ( MAX ( 'Well List'[Operator] ), 'Well List'[WellID] = TOPWELL )
RETURN
IF ( MAX ( 'Well List'[Operator] ) = _topclient, 1, 0 )Best Regards
Rena
- Anonymous6 years agoNot applicable
Hi Anonymous ,
Thanks for your answer, i already tried that way before with the result but, i see in your example you have two "JJ", so basically how would you add the 1 value in all the JJ's in the column?
- parry2k6 years agoSuper User
Anonymous Anonymous solution should work, not sure why is not showing 1 for each JJ operator, I created sample data and used following measure
Top Operator = VAR __topId = CALCULATE ( MAX ( Well[Id] ), ALL ( Well ) ) VAR __topOpertor = CALCULATE ( MAX ( Well[Operator] ), Well[Id] = __topId ) RETURN IF ( MAX ( Well[Operator] ) = __topOpertor, 1, 0 )I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
- Anonymous6 years agoNot applicable
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
- parry2k6 years agoSuper User
Anonymous I don't understand why we are all after creating the column when measure can do the job. Do we understand the difference between creating measure vs columns and how it has an impact on the model?