The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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
User | Count |
---|---|
27 | |
12 | |
8 | |
7 | |
5 |
User | Count |
---|---|
31 | |
15 | |
12 | |
7 | |
6 |