Forum Discussion

GLIDO's avatar
GLIDO
Helper I
8 years ago
Solved

RELATED function not working

Hi Community People, 

 

I have three tables the relation among them is 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

where TENANT.ID=LOAN_APPLICATION.TENANT_ID and 

           "Login Acceptance Date". "Application Number"= LOAN_APPLICATION.APPLICATION_NUMBER

 

Now we are required to create a measure, "Carry Over Leads" with the following formula, 

 

 

 

 

 

 

Now the issue is, I can't access the tenant table by using related function to compare to a field of login acceptance date. 

 

Can anyone help me out in this ? I am quite new to Power BI. I tried RELATED TABLES too but that also doesn't seem the correct option. All the joins are active and Cross Filter Direction has been set to both.

 

Thanks in advance

 

 

  • Hi GLIDO,

     

    As the picture you shared, actually there is no relationship between Login Acceptance Date and TENANT. So you cannot use the RELATED function here. Based on my test, we can take the following steps to meet your requirement.

     

    1. Create a new column in LOAN_APPLICATION table.

    Login date = RELATED('Login Acceptance Date'[Login date])


    2. Create a new measure.

     

    Measure 2 = CALCULATE(COUNT(LOAN_APPLICATION[ID]),FILTER(LOAN_APPLICATION,LOAN_APPLICATION[date_of_receipt]<RELATED(TENANT[Start Date])),FILTER(LOAN_APPLICATION,LOAN_APPLICATION[Login date]<RELATED(TENANT[Start Date])))

     

    3. Then we can get the result as below.

     

    For more details, please check the pbix as attached.

     

    https://www.dropbox.com/s/g4rjig9r5zbb1mo/RELATED3.pbix?dl=0

     

    Regards,
    Frank

2 Replies

  • v-frfei-msft's avatar
    v-frfei-msft
    Community Support

    Hi GLIDO,

     

    As the picture you shared, actually there is no relationship between Login Acceptance Date and TENANT. So you cannot use the RELATED function here. Based on my test, we can take the following steps to meet your requirement.

     

    1. Create a new column in LOAN_APPLICATION table.

    Login date = RELATED('Login Acceptance Date'[Login date])


    2. Create a new measure.

     

    Measure 2 = CALCULATE(COUNT(LOAN_APPLICATION[ID]),FILTER(LOAN_APPLICATION,LOAN_APPLICATION[date_of_receipt]<RELATED(TENANT[Start Date])),FILTER(LOAN_APPLICATION,LOAN_APPLICATION[Login date]<RELATED(TENANT[Start Date])))

     

    3. Then we can get the result as below.

     

    For more details, please check the pbix as attached.

     

    https://www.dropbox.com/s/g4rjig9r5zbb1mo/RELATED3.pbix?dl=0

     

    Regards,
    Frank

    • GLIDO's avatar
      GLIDO
      Helper I

      Hi v-frfei-msft

       

      Great great thanks for the solution, but that seemed more of a workaround. 

       

      In cases where I've to deal with over 8 10 tables, I don't think creating an instance of the target column(e.g. 'Login Acceptance Date'.'Login Acceptance Date') in the parent table(e.g LOAN_APPLICATION) is going to work there. 

      So what should be my approach when I have to fetch data through tables connected by 2 or more level of join. 

       

      I addition, talking about the current context, 

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

      In this case I can't create formulas having filters like, 

      FILTER(TENANT,TENANT['Start Date']>Related(LOAN_APPLICATION[DATE_OF_RECEIPT]))   OR

      FILTER('Login Acceptance Date'.'Login Acceptance Date'['Login Acceptance Date'])>Related(LOAN_APPLICATION[DATE_OF_RECEIPT]))

      but I can create filters like 

      FILTER(LOAN_APPLICATION,LOAN_APPLICATION[DATE_OF_RECEIPT]<Related(TENANT['Start Date'])) and 

      FILTER(LOAN_APPLICATION,LOAN_APPLICATION[DATE_OF_RECEIPT]<Related('Login Acceptance Date'['Login Acceptance Date']))

       

      Can you explain me this behaviour.