Forum Discussion
Custom column
Hi, Anonymous
Based on your description, you need to create an index column in 'Query Editor'. The pbix file is attached in the end.
Then you may create a calculated column and a measurem, or only a measure.
Calculated column:
Column =
IF(
[Index]=0,
[Depth from],
LOOKUPVALUE('Table'[Depth to],'Table'[Index],[Index]-1)
)
Measure:
Measure 1 =
IF(
ISFILTERED('Table'[Depth from]),
SUM('Table'[Column]),
LOOKUPVALUE('Table'[Depth to],'Table'[Index],CALCULATE(MAX('Table'[Index]),ALL('Table')))
)
or
Measure 2 =
var _index = SELECTEDVALUE('Table'[Index])
return
IF(
ISFILTERED('Table'[Depth from]),
IF(
_index=0,
SELECTEDVALUE('Table'[Depth from]),
LOOKUPVALUE('Table'[Depth to],'Table'[Index],_index-1)
),
LOOKUPVALUE('Table'[Depth to],'Table'[Index],CALCULATE(MAX('Table'[Index]),ALL('Table')))
)
Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous6 years agoNot applicable
- v-alq-msft6 years agoCommunity Support
Hi, Anonymous
You may create a measure as below. The pbix file is attached in the end.
Result = var _stepno = SELECTEDVALUE('Table'[Step No]) return IF( ISFILTERED('Table'[Depth from]), IF( _stepno=1, SELECTEDVALUE('Table'[Depth from]), LOOKUPVALUE('Table'[Depth to],'Table'[Step No],_stepno-1) ), LOOKUPVALUE('Table'[Depth to],'Table'[Step No],CALCULATE(MAX('Table'[Step No]),ALL('Table'))) )Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous6 years agoNot applicable
Hi v-alq-msft I would need that last value from the Depth to (500) to be at the bottom in the Result column. Can we add step 9 in the step_no column and have 500 value in the Depth to in the same row?