Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
kumsha1
Post Patron
Post Patron

Fill down the column values with a calculated column

Hi,

 

Can someone please help with the DAX to fill down the values for TONNES_LINE, so the 0 will be replaced by the actual value...it's required in a calculated column. Thanks !

 

kumsha1_0-1602747305528.png     

 

1 ACCEPTED SOLUTION
v-janeyg-msft
Community Support
Community Support

Hi, @kumsha1 

 

It’s my pleasure to answer for you.

According to your description, I think you can create a measure to calculate the correct result.

Like this:

 

Measure =
IF (
    SELECTEDVALUE ( Table1[TONNES_LINE] ) = 0,
    VAR a =
        MAXX (
            FILTER (
                ALL ( Table1 ),
                [Index] < SELECTEDVALUE ( Table1[Index] )
                    && Table1[TONNES_LINE] <> 0
            ),
            [Index]
        )
    RETURN
        MAXX ( FILTER ( ALL ( Table1 ), Table1[Index] = a ), Table1[TONNES_LINE] ),
    SELECTEDVALUE ( Table1[TONNES_LINE] )
)

 

1.png

If it doesn’t solve your problem, please feel free to ask me.

 

Best Regards

Janey Guo

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

10 REPLIES 10
v-janeyg-msft
Community Support
Community Support

Hi, @kumsha1 

 

It’s my pleasure to answer for you.

According to your description, I think you can create a measure to calculate the correct result.

Like this:

 

Measure =
IF (
    SELECTEDVALUE ( Table1[TONNES_LINE] ) = 0,
    VAR a =
        MAXX (
            FILTER (
                ALL ( Table1 ),
                [Index] < SELECTEDVALUE ( Table1[Index] )
                    && Table1[TONNES_LINE] <> 0
            ),
            [Index]
        )
    RETURN
        MAXX ( FILTER ( ALL ( Table1 ), Table1[Index] = a ), Table1[TONNES_LINE] ),
    SELECTEDVALUE ( Table1[TONNES_LINE] )
)

 

1.png

If it doesn’t solve your problem, please feel free to ask me.

 

Best Regards

Janey Guo

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-janeyg-msft , i tried creating above measure but it never returned any results and having performance impact on the report. Previously i was able to create RunningMax for other columns for similar requirement but when i try to do the same for TONNES_LINE column i am getting below error. Any further help on this is much appreciated.

 

kumsha1_0-1605147680723.png

 

Hi, @kumsha1 

 

Use 'calculate' in column is not a good choice because it may cause error,try to change to 'maxx'.

 

Best Regards

Janey Guo

Hi @v-janeyg-msft , I tried MAX/MAXX with no luck. Referring to your previous measure formula, my understanding is Table1[Index] is the Index column but What is [Index] ?

Hi, @kumsha1 

In order to calculate the result more conveniently, you may need to create a index column in PQ first,then create the msasure I mentioned.

Like this:

12.png

Best Regards

Janey Guo

 

richbenmintz
Resident Rockstar
Resident Rockstar

Hi @kumsha1,

 

Are you looking to replace the 0 with the prior row value of either progressive_ton_start or progressive_tonnes if there is a value?



I hope this helps,
Richard

Did I answer your question? Mark my post as a solution! Kudos Appreciated!

Proud to be a Super User!


Hi @kumsha1 ,

 

Can you try creating the following columns

 

 

val = if([PROGRESSIVE_TON_START] <> 0, [PROGRESSIVE_TON_START], [PROGRESSIVE_TONNES])

 

TONNES_LINE = 
var from_date = [FROM_DATE]
var prior_ton_time =
if([val] = BLANK(), CALCULATE(MAX([FROM_DATE]), FILTER(ALL('Table'), [FROM_DATE]<= from_date && [val] <> BLANK())), from_date)
return
CALCULATE(MAX([val]), FILTER(ALL('Table'), [FROM_DATE]>=prior_ton_time && [FROM_DATE] <=from_date))

 

Hope this Helps,
Richard
Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

 



I hope this helps,
Richard

Did I answer your question? Mark my post as a solution! Kudos Appreciated!

Proud to be a Super User!


Hi @richbenmintz , I tried your formulas and the TONNES_LINE was never executed with an error not enough memory.

vivran22
Community Champion
Community Champion

Hey @kumsha1 ,

 

You may try this as calculated column:

 

Tonne_Line =
IF (
    Table[Progressive_Ton_start] = 0
        && NOT ISBLANK ( Table[Progressive_Tonnes] ),
    Table[Progressive_Tonnes],
    Table[Progressive_Ton_start]
)

 

Cheers!
Vivek

Blog: vivran.in/my-blog
Connect on LinkedIn
Follow on Twitter

lbendlin
Super User
Super User

please provide the sample data in usable format. Does it have to be DAX?  Do you want a calculated column or a measure?

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.