cancel
Showing results for
Did you mean:
Frequent Visitor

## Cumulative measure with inactive relationship between 2 fact tables

Hello all!

I have two fact tables that have no active relationship. I need to take the sum of the quantity in one of them (transactions) and take it to the other (quote) --> this last have the Close price of different stocks. I need the quantity of the other table to multiply quantity * price.

I was able to get the quantity using ALLRELATIONSHIP and  it works fine, but the accumulative measure is not working. I'm using this:

Accumulated Stock Qty =

CALCULATE(
[UR Stock Qty],
FILTER(
ALL(
'Calendar'),
'Calendar'[Fecha] <= MAX('Calendar'[Fecha]
)))
I'm copying a link to the PBI file so you can see it below:

https://1drv.ms/u/s!AvSFZ2hooRIDgdgFkvrnNGCtXLqlRQ?e=hYwdF1

Hope you can help me with this.

3 REPLIES 3
Super User

@AndresOHV , First create a measure with userelationship and then use it in the same formula, that should work

example

New Qty = calculate(Sum(Table[Qty]), userelationship(Table[Date], Date[Date]))

Accumulated Stock Qty =
CALCULATE(
[New Qty],
FILTER(
ALL(
'Calendar'),
'Calendar'[Fecha] <= MAX('Calendar'[Fecha]
)))

New Member

I forgot to mention, the relationship is between 2 fact tables, not between a fact table and calendar.

New Member

Hello @amitchandak

That's exactly what I'm doing, the first measure works fine but when I try to use the accumulated measure it doesn't work. It shows the same number as the new Qty measure.
Sorry I'm answering from a different account right now.

Announcements

#### Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

#### Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

#### Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Top Solution Authors
Top Kudoed Authors