alfranco17
Board Regular
- Joined
- Apr 14, 2013
- Messages
- 198
Hi.
I'm trying to get the value of non-expired inventory for a period.
This is the expected result:
And this is what I get with the relationship. As soon as I connect Periods to Inventory (there are several measures that require it, and this non-expired was kind of a latter request) I get only one month.:
I believe I'm missing an ALL() somewhere, but I am really stuck.
Would you please help?
No relationship
With relationship
Or this one:
But as soon as I define a relationship, it only gets that one month:
Thanks.
Armando.
I'm trying to get the value of non-expired inventory for a period.
This is the expected result:
And this is what I get with the relationship. As soon as I connect Periods to Inventory (there are several measures that require it, and this non-expired was kind of a latter request) I get only one month.:
I believe I'm missing an ALL() somewhere, but I am really stuck.
Would you please help?
No relationship
With relationship
Excel Formula:
Available CALCULATE :=
VAR __PeriodStart =
MIN ( Months[Start] )
VAR __PeriodEnd =
MAX ( Months[Start] )
RETURN
CALCULATE (
SUM ( Inventory[Quantity] ),
FILTER (
Inventory,
AND (
Inventory[Valid from] <= __PeriodEnd,
Inventory[Valid to] >= __PeriodStart
)
)
)
Or this one:
Code:
Available SUMX:=VAR __PeriodStart =
MIN ( Months[Start] )
VAR __PeriodEnd =
MAX ( Months[End] )
RETURN
SUMX(
FILTER (
Inventory,
AND(Inventory[Valid from] <= __PeriodEnd,
Inventory[Valid to] >= __PeriodStart)
),
Inventory[Quantity]
)
But as soon as I define a relationship, it only gets that one month:
Thanks.
Armando.