Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
RafaelAri
Helper I
Helper I

Set Measure value based on 2 tables

Hello experts,

I have 3 data tables: list of items (dim), inventory in warehouses (fact) and inventory transactions in warehouses (fact).
The 2 "fact" tables are linked in model to the "dim" table through "item number".
I need to set a measure that will display: (quantity in warehouses) / (summary of transactions in last 30 days).

Here are the measures I have now, bu results of Qty. WH/Trans. 30 days are not correct:

Trans. 30 days = CALCULATE(
                                SUM(fctStockTransactions[TransQty.]),
                                    FILTER(fctStockTransactions, DATEDIFF(fctStockTransactions[TransDate],TODAY(),DAY)<=30)
                                )

Qty. WH = SUM(fctWHINventory[WHQty.])

2 REPLIES 2
RafaelAri
Helper I
Helper I

Thanks, I appreciate your help, but this is not what I need.
I need a measure that gives me value for: (Sum[Qty.-in-Stock])/(Sum(Transactions[TransQty.] in last 30 days) for each Item-No.

amitchandak
Super User
Super User

@RafaelAri , Try with help from

 

Rolling 30 = CALCULATE(Sum(fctStockTransactions[TransQty.]) ,DATESINPERIOD('Date'[Date],MAX('Date'[Date]),-30,DAY))

 

Rolling 30 = CALCULATE(Sum(fctStockTransactions[TransQty.]) , WINDOW(-29,REL, 0, REL, ADDCOLUMNS(ALLSELECTED('Date'[Date] ),ORDERBY([Date],asc)))

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.