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
mardennn
Regular Visitor

Lastnonblank value minus 12

Hi

 

I need two values each row. One is each row lastnonblank value (here I use LASTNONBLANK function) and value_12 = lastnonblank - 12.

 

For example: (I need value no 13 and no 1)

1   2,2

2   10,0

3   8,8

4   1,1

5   5,5

6   9,9

7   3,3

8   1,9

9   7,9

10  4,6

11  3,4

12  5,4

13  7,2

 

What I have to do in PowerBi?

3 REPLIES 3
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @mardennn,

 

Could you please mark the proper answer as solution or share the solution if it's convenient for you? That will be a big help to the others.

 

Best Regards!
Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @mardennn,

 

1. As a calculated column.

CalcultedColumn =
VAR lastColumn1 =
    MAX ( [Column1] )
RETURN
    CALCULATE (
        VALUES ( Table1[Value_12] ),
        'Table1'[Column1]
            IN { lastColumn1, lastColumn1 - 12 }
    )

Lastnonblank value minus 121.JPG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2. As a measure.

Measure =
VAR lastColumn =
    CALCULATE ( MAX ( 'Table1'[Column1] ), ALL ( 'Table1' ) )
RETURN
    CALCULATE (
        MAX ( 'Table1'[Value_12] ),
        FILTER ( 'Table1', 'Table1'[Column1] IN { lastColumn, lastColumn - 12 } )
    )

Lastnonblank value minus 122.JPG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

If these aren't what you want, please post a sample of the result.

 

 

Best Regards!

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
mardennn
Regular Visitor

Hi

 

I need two values each row. One is each row lastnonblank value (here I use LASTNONBLANK function) and value_12 = lastnonblank - 12.

 

For example: (I need value no 13 and no 1)

1   2,2

2   10,0

3   8,8

4   1,1

5   5,5

6   9,9

7   3,3

8   1,9

9   7,9

10  4,6

11  3,4

12  5,4

13  7,2

 

What I have to do in PowerBi?

Helpful resources

Announcements
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.