Forum Discussion

drrai66's avatar
drrai66
Resolver I
8 years ago
Solved

Need Help On Creating a Column from two linked Data sources

Hi Guys,

I really Need Help Here to Convert This in Tableau to Power BI. Scenario is If I have two Tables In Tableau  Like:

 

Table1

 

Student Marks
A80
B90
C100
D50
E45

 

and 

Student Age
A12
B13
C14

 

and I bulid Relationship in Tableau on Student then I would write a Calculation Such as

 

IF (ATTR(Student from Source 1)=ATTR(Student from Source2) THEN 1 ELSE 0 END

 This would  Return a Column  In Table 1 as

 

Student MarksResult
A801
B901
C1001
D500
E450

 

Please give me equivalent formula in Power BI

 

Thanks

Deepak

  • Create a calculated column in Table1 using the formula below

     

    if(calculate(countrows(table2),filter(table2,table2[Student]=table1[Student]))>0,1,0)

3 Replies

  • Nishantjain's avatar
    Nishantjain
    Continued Contributor

    Create a calculated column in Table1 using the formula below

     

    if(calculate(countrows(table2),filter(table2,table2[Student]=table1[Student]))>0,1,0)

  • Hi drrai66,

     

    To achieve your requirement, you can try this:

     

    1. Create a relationship between Source1 and Souce2.

    2. Create a measure like:

     

    Result =
    IF ( ISBLANK ( CALCULATE ( MAX ( Source2[Age] ) ) ), 0, 1 )

     

    Thanks,
    Xi Jin.

    • drrai66's avatar
      drrai66
      Resolver I

      Yours Solution Looks pretty good, but the first formula gave me what I needed in my Actual Data set. Thanks for your Time !!!

      Deepak