Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin 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.
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
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 11 | |
| 9 | |
| 8 | |
| 7 | |
| 7 |