Forum Discussion
jaxdave
4 years agoFrequent Visitor
USERELATIONSHIP
I have three (relevant) tables: a dimension table of Current Employee Contracts (Dim_Contract) – each row is a contract and each contract has a unique contract id – a two-column dimension table (Dim_...
v-jingzhang
4 years agoCommunity Support
Hi jaxdave
I guess the problem may be in the following section.
"earnedweeks",
VAR _contractstart = RELATED ( Dim_Contract[SignDate] )
VAR _contractend = IF ( ISBLANK ( RELATED ( Dim_Contract[ContractEndDate] ) ), TODAY(), RELATED ( Dim_Contract[ContractEndDate] ) )
You may try modify the RELATED(Dim_Contract[xxxxx]) parts to use USERELATIONSHIP directly. For example,
var _contractstart =
CALCULATE (
RELATED ( Dim_PrevContract[SignDate] ),
USERELATIONSHIP ( Fact_Compensation[ContractID], Dim_PrevContract[PrevContractID] )
)
* Modify RELATED ( Dim_Contract[ContractEndDate] ) part similarly. I think here you should get SignDate and ContractEndDate from previous contracts table rather than the current contracts table.
Hope it helps.
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.