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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
joshua1990
Post Prodigy
Post Prodigy

Value previous row per Order

Hi community!

I have a table with values per orders for each step. 

Order Step Value
101 1 5
101 2  
101 3 4
102 1 6

As you can see not every row has a value.

Now if a value is missing, then I would like to add the last available qty for each order based in the column Step.

 

How would you do this?

 

2 ACCEPTED SOLUTIONS
ThxAlot
Super User
Super User

Super easy, nothing but one click on the button.

 

ThxAlot_0-1681691841476.png

 

DAX measure is also working well.

 

ThxAlot_1-1681692483613.png

At least 2 solutions in calculated column

 

ThxAlot_2-1681693500150.png

 

ThxAlot_3-1681693555529.png

 



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



View solution in original post

hi @joshua1990 

the code shall still work. i tried with such data below:

FreemanZ_0-1681710247444.png

 

Is there something i didn't get?

View solution in original post

4 REPLIES 4
ThxAlot
Super User
Super User

Super easy, nothing but one click on the button.

 

ThxAlot_0-1681691841476.png

 

DAX measure is also working well.

 

ThxAlot_1-1681692483613.png

At least 2 solutions in calculated column

 

ThxAlot_2-1681693500150.png

 

ThxAlot_3-1681693555529.png

 



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



FreemanZ
Super User
Super User

hi @joshua1990 

try to add a calculated column like:

Column2 = 
VAR _table =
    FILTER(
        Data,
        Data[Order]=EARLIER(Data[Order])
            &&Data[Step]<=EARLIER(Data[Step])
            &&Data[Value]<>BLANK()
    )
VAR _steppre =
    MAXX(_table, Data[Step])
VAR result =
    MAXX(
        FILTER(
            _table,
            Data[Step]=_steppre
        ),
        Data[Value]
    )
RETURN
    result

or 

Column = 
VAR _table =
    FILTER(
        Data,
        Data[Order]=EARLIER(Data[Order])
            &&Data[Step]<EARLIER(Data[Step])
    )
VAR _steppre = 
    MAXX(_table, Data[Step])
VAR _valuepre =
    MAXX(
        FILTER(
            _table,
            Data[Step]=_steppre
        ),
        Data[Value]
    )
VAR result =
    IF(
        ISBLANK([Value]), 
        _valuepre, 
        [Value]
    )
RETURN 
    result

 

it worked like:

FreemanZ_0-1681654687820.png

 

@FreemanZ : Thanks a lot! That works perectly well.

But I missed 1 key information - I'm sorry for that.

What if two rows are blank? Based on the approach above just the first blank will be replaced.

Any idea here as well?

hi @joshua1990 

the code shall still work. i tried with such data below:

FreemanZ_0-1681710247444.png

 

Is there something i didn't get?

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.