This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
Hi!
First of all, thanks in advance for the help!
I have to calculate the increase of costs for different product from different suppliers between dates.
So for that I have a table called "price_history" where every supplier's price list is registered the day it is sended to me, like the following:
* The "UPDATE DATE" is a date type colum, not a string like here in the example.
| PRODUCT | PRICE | SUPPLIER | UPDATE DATE |
| PRODUCT_1 | 17,79 | SUPPLIER_A | February-19 |
| PRODUCT_1 | 19,21 | SUPPLIER_B | April-19 |
| PRODUCT_2 | 39,98 | SUPPLIER_A | February-19 |
| PRODUCT_3 | 73,43 | SUPPLIER_B | April-19 |
| PRODUCT_1 | 21,05 | SUPPLIER_A | June-20 |
| PRODUCT_2 | 53,85 | SUPPLIER_A | June-20 |
| PRODUCT_3 | 101,25 | SUPPLIER_B | July-20 |
| PRODUCT_1 | 23,01 | SUPPLIER_B | July-20 |
And I have the following measures:
Cost_MaxDate =
var lastdate = maxx('price_history','price_history'[UPDATE DATE])
return
calculate ([COST],
filter ('price_history','price_history'[UPDATE DATE]=lastdate))
Cost_MinDate =
Solved! Go to Solution.
@mmunoa , Can you try the Min Cost Like
Cost_MinDate =
var firstdate = maxx('price_history','price_history'[UPDATE DATE])
return
calculate (lastnonblankvalue('price_history'[UPDATE DATE],[COST]),
filter (all('price_history'),'price_history'[UPDATE DATE]<firstdate))
or
Cost_MinDate =
var firstdate = maxx('price_history','price_history'[UPDATE DATE])
return
calculate (lastnonblankvalue('price_history'[UPDATE DATE],[COST]),
filter (all('price_history'),'price_history'[UPDATE DATE]<firstdate && 'price_history'[product] =max('price_history'[product])))
or
Cost_MinDate =
var firstdate = maxx('price_history','price_history'[UPDATE DATE])
return
calculate (lastnonblankvalue('price_history'[UPDATE DATE],[COST]),
filter (all('price_history'),'price_history'[UPDATE DATE]<firstdate && 'price_history'[product] =max('price_history'[product] && 'price_history'[SUPPLIER] =max('price_history'[SUPPLIER])))
@mmunoa , Can you try the Min Cost Like
Cost_MinDate =
var firstdate = maxx('price_history','price_history'[UPDATE DATE])
return
calculate (lastnonblankvalue('price_history'[UPDATE DATE],[COST]),
filter (all('price_history'),'price_history'[UPDATE DATE]<firstdate))
or
Cost_MinDate =
var firstdate = maxx('price_history','price_history'[UPDATE DATE])
return
calculate (lastnonblankvalue('price_history'[UPDATE DATE],[COST]),
filter (all('price_history'),'price_history'[UPDATE DATE]<firstdate && 'price_history'[product] =max('price_history'[product])))
or
Cost_MinDate =
var firstdate = maxx('price_history','price_history'[UPDATE DATE])
return
calculate (lastnonblankvalue('price_history'[UPDATE DATE],[COST]),
filter (all('price_history'),'price_history'[UPDATE DATE]<firstdate && 'price_history'[product] =max('price_history'[product] && 'price_history'[SUPPLIER] =max('price_history'[SUPPLIER])))
Thank you very much! It didnt worked just like its expressed here but it gave me the tools and "way of thinking" to solve it.
Thank you!!!
Thanks @amitchandak for helping!
I tested it with the three options but it doesn't work, but i forgot to say something:
I also have a calendar table related to the 'price_history'[UPDATE DATE] column.
Maybe thats important for understanding better the problem, because when if filter between two dates, I do it on the date table (Which is supposed to filter the price_history table)
@mmunoa , Try like
Cost_MinDate =
var firstdate = maxx('Date','Date'[DATE])
return
calculate (lastnonblankvalue('Date'[DATE],[COST]),
filter (all('Date'),'Date'[ DATE]<firstdate))
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 11 | |
| 7 | |
| 6 | |
| 6 | |
| 4 |