Forum Discussion
Help: Using earlier row values as condition
- 9 years ago
This is the kind of data shaping to be done with M (Power Query), not with DAX.
In "Edit queries", add column "Country" with formula
if [CountryOrCity] = "Country" then [Location] else null
Next, go to the Tranform tab, make sure the new Country column is selected, and choose Fill - Fill Down.
Thanks for the help! I originally derived the Country/City column as a calculated column so doing it via Power Query wasn't intuitive to me but your answer brought me back to the right track.
On a separate note, does that also mean that there is no good way of doing this via a calculated column rather than via M?
In my view, it is not a good way to do it in DAX.
Then again, it might still be possible in DAX, but that's not my expertise, so I just don't know and I leave the answer to that question to the DAX experts over here.