Forum Discussion
Anonymous
6 years agoNot applicable
Custom column
Hi, so I have two columns depth from and depth to. I need to create a new column called Total depth that: - has the first row the same as in depth from (30 in this case) - the rest of rows are copi...
v-alq-msft
6 years agoCommunity Support
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.
Anonymous
6 years agoNot applicable