Forum Discussion

ktt777's avatar
ktt777
Helper V
6 years ago
Solved

filter with relationship

Hi 

 

I have a table as below :

 

PeriodCountry Sale TypeStatus
1/1/2020Vietnam1InternalActive
1/1/2020Lao3InternalActive
1/1/2020Germany4External Active
1/1/2020France5External Active
1/2/2020Vietnam4InternalActive
1/2/2020Lao3External Active
1/3/2020Germany2InternalActive
1/3/2020France1External Active

 

it has relationship with below table :

RegionCountry 
AsiaVietnam
AsiaLao
EuropeGermany
EuropeFrance

 

How to i write dax fomular to calculate sale for different region ?

 

thanks , 

  • ktt777 , 

    If your expected output is like above post so follow the below steps and also I attached screen shot for your reference:

    Step 1: Create relationship between both the table based on Country.

    Step 2: Create DAX Measure like below in SALES table:

    Region_Sales = CALCULATE(SUM('SALES'[Sale]),ALLEXCEPT(REGIONS,REGIONS[Region]))
     
     
     

3 Replies

    • Tahreem24's avatar
      Tahreem24
      Super User

      ktt777 , 

      If your expected output is like above post so follow the below steps and also I attached screen shot for your reference:

      Step 1: Create relationship between both the table based on Country.

      Step 2: Create DAX Measure like below in SALES table:

      Region_Sales = CALCULATE(SUM('SALES'[Sale]),ALLEXCEPT(REGIONS,REGIONS[Region]))
       
       
       
  • ktt777 , Join Country with country in both tables and then put region with sum sales in any visual ?