cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
FrancoIVM
New Member

Use the current row date

Hi,

I want to calculate the last price from a column filter by date, but i want that the dates that are being evaluated ends at the current date of the row.

 

something like:

Last price bt = CALCULATE(
LASTNONBLANKVALUE(
table[dates],
SUM(table[prices])),
DATESBETWEEN(table[dates],FIRSTDATE(table[dates]),
"""end_date"""))
 
I want that end_date can be the date of the current row if that is posible. Like:
Table:
[Dates] [Price] [Last price] [Last price bt]  
1-1-1    100          150             100
1-1-2                    150             100
1-1-3                    150             100
1-1-4     120         150             120
1-1-5     150         150             150
 
 
 
 
1 ACCEPTED SOLUTION
DataZoe
Super User II
Super User II

Hi @FrancoIVM , please try this measure:

Previous Price =
CALCULATE (
    LASTNONBLANKVALUE (
        'Table'[Dates],
        [Unit Price]
    ),
    FILTER (
        ALLSELECTED ( 'Table'[Dates] ),
        ISONORAFTER (
                'Table'[Dates], MAX ( 'Table'[Dates] )DESC
        )
    )
)

DataZoe_0-1601943948717.png

 

 

Respectfully,
DataZoe


See my reports and blog at https://www.datazoepowerbi.com/

View solution in original post

1 REPLY 1
DataZoe
Super User II
Super User II

Hi @FrancoIVM , please try this measure:

Previous Price =
CALCULATE (
    LASTNONBLANKVALUE (
        'Table'[Dates],
        [Unit Price]
    ),
    FILTER (
        ALLSELECTED ( 'Table'[Dates] ),
        ISONORAFTER (
                'Table'[Dates], MAX ( 'Table'[Dates] )DESC
        )
    )
)

DataZoe_0-1601943948717.png

 

 

Respectfully,
DataZoe


See my reports and blog at https://www.datazoepowerbi.com/

View solution in original post

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

Top Solution Authors
Top Kudoed Authors