Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
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!
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
User | Count |
---|---|
70 | |
35 | |
21 | |
18 | |
15 |
User | Count |
---|---|
128 | |
29 | |
28 | |
24 | |
22 |