Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Fetch data from RelatedTable and Selected Column

I have 4 tables linked as follows:

  • Tab_sales and tab_Entity: 1 to many relationship (one side from tab_Entity) using column Entity
  • Tab_Entity and Tab_forex: a many-to-many relationship using column CURRENCY
  • Tab_forex and Tab_scenario: 1 to many relationship (one side from tab_scenario) using column Scenario
  • Tab_scenario_forex: 1 to many relationship (1 side from tab_scenarioForex) using column Scenario

 

I'd like to create a calculated column in Tab_Entity fetching the value Ex. rate from tab_Forex, changing based on the value selected from tab_scenario, so that I can choose the exchange rate I want to use for Sales (either ACT or Plan).

 

I tried this way creating a calculated column in tab_Entity:

forex = CALCULATE (SUMX('Tab_forex', 'Tab_forex'[Ex rate]),

RELATEDTABLE(Tab_Forex)

 

but the results is not filtered by Scenario from tab_Scenario_forex

Anybody can recommend a solution?

 

Thanks a lot

Mark

 

 

Tab_sales

EntitySales
USA100000
Mexico3000
Italy2500
France5000
Germany2000
France700
USA20000
Mexico5000

 

 

 

Tab_Entity

 

EntityCurrency
USAUS$
MexicoMXN
FranceEUR
GermanyEUR
ItalyEUR
SpainEUR

 

 

Tab_forex

 

CurrencyScenarioEx. rate
EURACT0.9
EURPlan0.8
US$ACT1
US$Plan1
MXNACT25
MXNPlan24

 

Tab_Scenario_Forex

 

Scenario
Plan
ACT
  • Anonymous ,

     

    I've changed the file. Please check it.  Download PBIX 

     

    I've include the ex.rate in the Sales table.

     

    Ricardo

3 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Ricardo,

       

      many thanks for this.

      The problem is still there: even if I select either ACT or Plan from the filter Scenario, the amount of sales doesn't change. The target is to have different amount of sales depending on the selected exchange rate scenario

       

      Mark

      • camargos88's avatar
        camargos88
        Community Champion

        Anonymous ,

         

        I've changed the file. Please check it.  Download PBIX 

         

        I've include the ex.rate in the Sales table.

         

        Ricardo