Forum Discussion
USERELATIONSHIP complex case
Hi,
I have a following business problem that I need your help solving.
I have two Dimension tables - Account Type DIM and Volume Type DIM
and One FACT table - Volume FACT (This is just a part of my complex data model)
The relationships from DIM to FACT are one to many and all are inactive relationships (I know I can keep one active relationship but I have delibrately kept it inactive). I have marked all the relationships columns in the below screen shot.
I want to calculate Total volume which can be done by summing the following columns =
VOLUME FACT[manual_opened_usd_volume] + VOLUME FACT[manual_closed_usd_volume] + VOLUME FACT[copytrading_opened_usd_volume] + VOLUME FACT[copytrading_closed_usd_volume]
Now In the report view I have the following slicers
I want the Total Volume to change when I interact with the slicers.
Let me share the DAX Expression that I wrote.
The Result is not filtering the data as it should and giving the following error when i select provider / follower from account_type slicer
4 Replies
- tamerj1Community Champion
Hi BI_kartik
Please tryTotal Volume_new = SUMX ( VALUES ( 'Account Type DIM'[id] ), VAR CurrentAccount = 'Account Type DIM'[id] RETURN CALCULATE ( VAR __Manual_open_volume = CALCULATE ( SUM ( 'VOLUME FACT'[manual_opened_usd_volume] ), USERELATIONSHIP ( 'VOLUME FACT'[Manual Open Volume Index], 'Volume Type DIM'[Index] ) ) VAR __Manual_close_volume = CALCULATE ( SUM ( 'VOLUME FACT'[manual_closed_usd_volume] ), USERELATIONSHIP ( 'VOLUME FACT'[Manual Close Volume Index], 'Volume Type DIM'[Index] ) ) VAR __Copytrading_open_volume = CALCULATE ( SUM ( 'VOLUME FACT'[copytrading_opened_usd_volume] ), USERELATIONSHIP ( 'VOLUME FACT'[Copy Trading Open Volume Index], 'Volume Type DIM'[Index] ) ) VAR __Copytrading_close_volume = CALCULATE ( SUM ( 'VOLUME FACT'[copytrading_closed_usd_volume] ), USERELATIONSHIP ( 'VOLUME FACT'[Copytrading Close Volume Index], 'Volume Type DIM'[Index] ) ) RETURN __Manual_open_volume + __Manual_close_volume + __Copytrading_open_volume + __Copytrading_close_volume, 'VOLUME FACT'[Provider Index] = CurrentAccount, 'VOLUME FACT'[Follower Index] = CurrentAccount ) )- tamerj1Community Champion
BI_kartik
This is the logic that I understood from your DAX code. I believe this is the condition that generates blanks everywhere'VOLUME FACT'[Provider Index] = CurrentAccount, 'VOLUME FACT'[Follower Index] = CurrentAccountWhat did you mean by activating the two relationships between 'VOLUMN FACT' and 'Account Type DIM' together?