Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi, colud you help me with DAX code. I need to create new column with values from another one. I need to repleace 0 value with first value until new value is there.
| Pomocny | Stlpec1 |
| 1000000 | 1000000 |
| 0 | 1000000 |
| 0 | 1000000 |
| 0 | 1000000 |
| 0 | 1000000 |
| 0 | 1000000 |
| 0 | 1000000 |
| 0 | 1000000 |
| 0 | 1000000 |
| 0 | 1000000 |
| 0 | 1000000 |
| 645826,7 | 645826,7 |
| 0 | 645826,7 |
| 0 | 645826,7 |
| 0 | 645826,7 |
| 0 | 645826,7 |
| 0 | 645826,7 |
| 0 | 645826,7 |
| 0 | 645826,7 |
| 0 | 645826,7 |
| 0 | 645826,7 |
| 0 | 645826,7 |
| 0 | 645826,7 |
| 311287,1 | 311287,1 |
| 0 | 311287,1 |
| 0 | 311287,1 |
| 0 | 311287,1 |
| 0 | 311287,1 |
| 0 | 311287,1 |
| 0 | 311287,1 |
| 0 | 311287,1 |
| 0 | 311287,1 |
| 0 | 311287,1 |
| 0 | 311287,1 |
| 0 | 311287,1 |
| 0 | 311287,1 |
I tried code like tihis but it is not working.
Solved! Go to Solution.
@LuciaS1 In Power Query, add an Index column. Then you can do this. PBIX is attached below signature.
Measure =
VAR __Index = MAX('Harok1'[Index])
VAR __Value = MAX('Harok1'[Pomocny])
VAR __Result =
IF(
__Value <> 0,
__Value,
VAR __Previous = MAXX(FILTER(ALL('Harok1'), [Index] < __Index && [Pomocny] <> 0), [Index])
VAR __Result = MINX(FILTER(ALL('Harok1'), [Index] = __Previous), [Pomocny])
RETURN
__Result
)
RETURN
__Result
@LuciaS1 In Power Query, add an Index column. Then you can do this. PBIX is attached below signature.
Measure =
VAR __Index = MAX('Harok1'[Index])
VAR __Value = MAX('Harok1'[Pomocny])
VAR __Result =
IF(
__Value <> 0,
__Value,
VAR __Previous = MAXX(FILTER(ALL('Harok1'), [Index] < __Index && [Pomocny] <> 0), [Index])
VAR __Result = MINX(FILTER(ALL('Harok1'), [Index] = __Previous), [Pomocny])
RETURN
__Result
)
RETURN
__Result
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 20 | |
| 10 | |
| 9 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 33 | |
| 31 | |
| 19 | |
| 12 | |
| 11 |