Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi how can i calculated last price change date
| How can i calculate in dax | ||||
| Recid | INVOICE_DATE | Product_Number | Purchise_Price | Last Purchise Change Date |
| 1500 | 16.04.2024 | AS.1248 | 510 | 09.04.2024 |
| 1499 | 15.04.2024 | AS.1248 | 510 | 09.04.2024 |
| 1498 | 13.04.2024 | AS.1248 | 510 | 09.04.2024 |
| 1497 | 12.04.2024 | AS.1248 | 510 | 09.04.2024 |
| 1496 | 11.04.2024 | AS.1248 | 510 | 09.04.2024 |
| 1495 | 09.04.2024 | AS.1248 | 510 | 09.04.2024 |
| 1494 | 08.04.2024 | AS.1248 | 470 | 27.03.2024 |
| 1493 | 06.04.2024 | AS.1248 | 470 | 27.03.2024 |
| 1492 | 05.04.2024 | AS.1248 | 470 | 27.03.2024 |
| 1491 | 04.04.2024 | AS.1248 | 470 | 27.03.2024 |
| 1490 | 03.04.2024 | AS.1248 | 470 | 27.03.2024 |
| 1489 | 02.04.2024 | AS.1248 | 470 | 27.03.2024 |
| 1488 | 01.04.2024 | AS.1248 | 470 | 27.03.2024 |
| 1487 | 30.03.2024 | AS.1248 | 470 | 27.03.2024 |
| 1486 | 29.03.2024 | AS.1248 | 470 | 27.03.2024 |
| 1485 | 28.03.2024 | AS.1248 | 470 | 27.03.2024 |
| 1484 | 27.03.2024 | AS.1248 | 470 | 27.03.2024 |
| 1483 | 26.03.2024 | AS.1248 | 450 | 07.03.2024 |
| 1482 | 25.03.2024 | AS.1248 | 450 | 07.03.2024 |
| 1481 | 23.03.2024 | AS.1248 | 450 | 07.03.2024 |
| 1480 | 22.03.2024 | AS.1248 | 450 | 07.03.2024 |
| 1479 | 21.03.2024 | AS.1248 | 450 | 07.03.2024 |
| 1478 | 20.03.2024 | AS.1248 | 450 | 07.03.2024 |
| 1477 | 19.03.2024 | AS.1248 | 450 | 07.03.2024 |
| 1476 | 18.03.2024 | AS.1248 | 450 | 07.03.2024 |
| 1475 | 16.03.2024 | AS.1248 | 450 | 07.03.2024 |
| 1474 | 15.03.2024 | AS.1248 | 450 | 07.03.2024 |
| 1473 | 14.03.2024 | AS.1248 | 450 | 07.03.2024 |
| 1472 | 13.03.2024 | AS.1248 | 450 | 07.03.2024 |
| 1471 | 12.03.2024 | AS.1248 | 450 | 07.03.2024 |
| 1470 | 11.03.2024 | AS.1248 | 450 | 07.03.2024 |
| 1469 | 09.03.2024 | AS.1248 | 450 | 07.03.2024 |
| 1468 | 08.03.2024 | AS.1248 | 450 | 07.03.2024 |
| 1467 | 07.03.2024 | AS.1248 | 450 | 07.03.2024 |
Solved! Go to Solution.
Hi @DRNEWTR I suspect that you are trying to capture the invoice date when the purchase price is changed for each product. I sorted the data by Recid and created a calculated DAX column to get your desired results. See the attached .pbix file.
Last Purchase Change Date (DAX) =
VAR CurrentRecid = 'Table'[Recid]
VAR CurrentPrice = 'Table'[Purchase_Price]
VAR CurrentProduct = 'Table'[Product_Number]
VAR PreviousPrice = CALCULATE(
LASTNONBLANK('Table'[Purchase_Price], 1),
FILTER(
ALL('Table'),
'Table'[Recid] < CurrentRecid
&& 'Table'[Product_Number] = CurrentProduct
)
)
RETURN
IF(
CurrentPrice <> PreviousPrice,
'Table'[INVOICE_DATE],
CALCULATE(
MIN('Table'[INVOICE_DATE]),
FILTER(
ALL('Table'),
'Table'[Recid] < CurrentRecid
&& 'Table'[Purchase_Price] = CurrentPrice
&& 'Table'[Product_Number] = CurrentProduct
)
)
)
Proud to be a Super User!
Hi @DRNEWTR I suspect that you are trying to capture the invoice date when the purchase price is changed for each product. I sorted the data by Recid and created a calculated DAX column to get your desired results. See the attached .pbix file.
Last Purchase Change Date (DAX) =
VAR CurrentRecid = 'Table'[Recid]
VAR CurrentPrice = 'Table'[Purchase_Price]
VAR CurrentProduct = 'Table'[Product_Number]
VAR PreviousPrice = CALCULATE(
LASTNONBLANK('Table'[Purchase_Price], 1),
FILTER(
ALL('Table'),
'Table'[Recid] < CurrentRecid
&& 'Table'[Product_Number] = CurrentProduct
)
)
RETURN
IF(
CurrentPrice <> PreviousPrice,
'Table'[INVOICE_DATE],
CALCULATE(
MIN('Table'[INVOICE_DATE]),
FILTER(
ALL('Table'),
'Table'[Recid] < CurrentRecid
&& 'Table'[Purchase_Price] = CurrentPrice
&& 'Table'[Product_Number] = CurrentProduct
)
)
)
Proud to be a Super User!
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 5 | |
| 5 | |
| 4 | |
| 4 | |
| 3 |
| User | Count |
|---|---|
| 24 | |
| 21 | |
| 13 | |
| 10 | |
| 8 |