Forum Discussion

korrigan's avatar
korrigan
Regular Visitor
5 years ago

Previous Period Calculation and Composite Model

Context:

1. I'm using the feature released earlier this year and allowing us to create a composite dataset based on several published datasets. To join the conformed dimensions (like calendar), I'm importing them into my composite model and linking all identical dimensions togethere with a 1:1 relationship (For instance, each of my 3 child models have a dim_calendar table, I'm importing the dim_calendar table in the composite model and link the 3 child dim_calendar tables on the unique calendar_key

2. All measures comping from the child models except one (see below) are working perfectly in the composite model.

2. In one of my data model, I calculating a "Previous Period" measure (I can't used PREVIOUSMONTH() function as a period is defined here as a group of 4 or 5 full weeks):

# Delivered Packages Previous Period = 

VAR _CurrentPeriod =

SELECTEDVALUE( 'Delivery Calendar'[OPS Period Index] )

VAR _PreviousPeriod =

CALCULATE( MAX( 'Delivery Calendar'[OPS Period Index] ),

FILTER(

ALLSELECTED( 'Delivery Calendar' ),

'Delivery Calendar'[OPS Period Index] < _CurrentPeriod ) )

VAR _Result =

CALCULATE( [# Delivered Packages],

FILTER(

ALLSELECTED( 'Delivery Calendar' ),

'Delivery Calendar'[OPS Period Index] = _PreviousPeriod

)

)

RETURN

_Result

In the model where this measure has been created, it works fine. However, whne I want to use it in the composite model, it's not working, see the 2 behaviours in the screenshot below:

I really want to understand what is not working as we are planning to base our data access solutions on composite datasets.

 

 

2 Replies