简体   繁体   中英

Power BI - Create table from Measure

In Power BI I have a list of inventory transactions (InventTrans) with date, quantity and value for movements in and out of the inventory.

There are 1 million lines of inventory transactions, and the sum of all lines for each ItemID gives the inventory value of that item.

I have created a measure to calculate number of days from last movement until today:

Days since last movement = DATEDIFF(CALCULATE(MAX(InventTrans[Date]),TODAY(),DAY)

and a measure (InventoryStatus) to group each ItemID based on this result.

I have used InventoryStatus = IF([Days since last movement]<183, "Movement last six months", ("Six months to a year", "Over 1 year". and so on)

Now I want to create a table with ItemID and the measure InventoryStatus. My aim is to use InventoryStatus as a filter, so maybe there is better way to achieve this without creating a new table with ItemID and InventoryStatus.

Assuming inventory status is a property of the item, not the transaction, your proposed approach is probably correct. The data model will be more intuitive and more efficient if you create an items table that has ItemID , InventoryStatus , and any other item-level data. After linking the two tables together InventoryStatus can be used as a filter for transactions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM