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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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