Calculate Amount of Inventory Change in Azure Analysis Services DAX

68 Views Asked by At

I have data in Azure Analysis Services (Tabular) that looks like the following table. I need to create two calculated columns for the Date that the Inventory Changed and the Amount of the Inventory Change. I think and IF function can take care of me for the date of the inventory changed. However, I'm stumped regarding how to calculate the amount of the inventory change.

What are some logical approaches to that?

Inventory Info in Analysis Services

1

There are 1 best solutions below

0
msta42a On

Try use this:

[Amount of the Inventory Change] = 'YourTable'[Current Inventory Number] -

calculate( max('YourTable'[Current Inventory Number]), filter(values('YourTable'[InventorySnapshotDate]) , 'YourTable'[InventorySnapshotDate] < lastDate('YourTable'[InventorySnapshotDate]) ))