Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register 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!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
8 | |
8 | |
8 |
User | Count |
---|---|
13 | |
12 | |
11 | |
10 | |
8 |