Forum Discussion
FrancoIVM
5 years agoNew 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"""))
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-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
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
)
)
)