Forum Discussion
Compare price previous non continuous date
- Anonymous4 years ago
Hi josfebo ,
Please update the formula of your measure [Previous Day Price 1] as below and check whether it can return the correct result...
Previous Day Price 1 = VAR current_date = SELECTEDVALUE ( d_Calendario[Fecha] ) VAR curresta = SELECTEDVALUE ( delivery_menu[Restaurante] ) VAR curitem = SELECTEDVALUE ( delivery_menu[xxcolumname] ) VAR previous_visibleDate = CALCULATE ( MAX ( delivery_menu[Fecha] ), FILTER ( ALLSELECTED ( delivery_menu ), delivery_menu[Restaurante] = curresta && delivery_menu[xxcolumname] = curitem && delivery_menu[Fecha] < current_date && [Precio] <> BLANK () ) ) VAR previous_visibleDatePrice = CALCULATE ( [Precio], FILTER ( ALLSELECTED ( delivery_menu ), delivery_menu[Restaurante] = curresta && delivery_menu[xxcolumname] = curitem && delivery_menu[Fecha] = previous_visibleDate ) ) RETURN previous_visibleDatePriceIn addition, you can refer the following links to get it.
Power Query method:
Get previous row in Power Query - EXPLAINED
DAX method:
Power BI DAX Getting the Value of Previous Non-NULL Row
Calculate previous row using DAX
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.
How to upload PBI in Community
Best Regards
Hi,
In the row which has the blue circles, what answer would you expect for 22/4/2022? Should the previous price as on this date be nil or 1.20?
Hi,
Your answers to Parry2K and me are completely different.