Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Need help to get a value from different table based on condition

Hi All,

I have two tables like below

 

Recruitment Table:

 

Recruitment IDDepartmentExperience TypeRecruitment Created DateRecruitment Close DateNo Of opening
R1AExperienced5/5/20185/20/20185
R2BExperienced5/10/20185/30/20184
R3CFresher5/5/20185/20/20183
R4CFresher5/10/20185/30/20182
R5CFresher5/1/20185/25/20184
R6AExperienced5/5/20175/20/20175
R7BFresher5/10/20175/30/20174

 

Registration Table:

 

Candidate IDDepartmentExperience TypeRegistered DateInterview Result
C1AExperienced5/15/2018Selected 
C2BExperienced5/15/2018Hold
C3AExperienced4/4/2018Selected 
C4BExperienced4/4/2018Selected 
C5AExperienced5/10/2018Selected 
C6BExperienced5/25/2018Rejected
C7CFresher5/15/2018Selected 
C8CFresher5/4/2018Rejected
C9CFresher5/25/2018Selected 
C10CFresher5/28/2018Rejected
C11DFresher5/28/2018Rejected
C11EFresher5/28/2018Rejected

 

Recuirment: 

1) I want to add Recruitment ID in Registration Table based on the below condition 

  • Registration Table. Department = Recruitment Table.Department 
  • Registration Table. Experience Type= Recruitment Table.Experience Type
  • Registration Table. Registered Date >= Recruitment Table.Recruitment Created Date & Registration Table. Registered Date<= Recruitment Close Date

2) when I select 5/25/2018 in Date filter, it wants to show active Recruitment ID details (selected Date >= Recruitment Table.Recruitment Created Date & selected Date<= Recruitment Close Date)

Screenshot_8.png

1 ACCEPTED SOLUTION
v-yulgu-msft
Employee
Employee

Hi @Anonymous,

 

Create a calculated table which combines Recruitment Table and Registration Table and create a date dimention table. Make sure the combined table is unrelated with date dimention table.

Combined Table =
FILTER (
    CROSSJOIN (
        SELECTCOLUMNS (
            Registration,
            "Candidate ID", Registration[Candidate ID],
            "Department2", Registration[Department],
            "Experience Type2", Registration[Experience Type],
            "Registered Date", Registration[Registered Date],
            "Interview Result", Registration[Interview Result]
        ),
        Recruitment
    ),
    [Department2] = [Department]
        && [Experience Type] = [Experience Type2]
        && [Registered Date] >= Recruitment[Recruitment Created Date]
        && [Registered Date] <= [Recruitment Close Date]
)

DateDim = CALENDAR(MIN(Recruitment[Recruitment Created Date]),MAX(Recruitment[Recruitment Close Date]))
 
Add corresponding fields into table visual. Add below measure into visual level filter and set its value to 1.
filter =
IF (
    SELECTEDVALUE ( DateDim[Date] )
        >= SELECTEDVALUE ( 'Combined Table'[Recruitment Created Date] )
        && SELECTEDVALUE ( DateDim[Date] )
            <= SELECTEDVALUE ( 'Combined Table'[Recruitment Close Date] ),
    1,
    0
)
1.PNG
 
Please refer to the uploaded .pbix file for detailed steps.
 
Best regards,
Yuliana Gu
Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-yulgu-msft
Employee
Employee

Hi @Anonymous,

 

Create a calculated table which combines Recruitment Table and Registration Table and create a date dimention table. Make sure the combined table is unrelated with date dimention table.

Combined Table =
FILTER (
    CROSSJOIN (
        SELECTCOLUMNS (
            Registration,
            "Candidate ID", Registration[Candidate ID],
            "Department2", Registration[Department],
            "Experience Type2", Registration[Experience Type],
            "Registered Date", Registration[Registered Date],
            "Interview Result", Registration[Interview Result]
        ),
        Recruitment
    ),
    [Department2] = [Department]
        && [Experience Type] = [Experience Type2]
        && [Registered Date] >= Recruitment[Recruitment Created Date]
        && [Registered Date] <= [Recruitment Close Date]
)

DateDim = CALENDAR(MIN(Recruitment[Recruitment Created Date]),MAX(Recruitment[Recruitment Close Date]))
 
Add corresponding fields into table visual. Add below measure into visual level filter and set its value to 1.
filter =
IF (
    SELECTEDVALUE ( DateDim[Date] )
        >= SELECTEDVALUE ( 'Combined Table'[Recruitment Created Date] )
        && SELECTEDVALUE ( DateDim[Date] )
            <= SELECTEDVALUE ( 'Combined Table'[Recruitment Close Date] ),
    1,
    0
)
1.PNG
 
Please refer to the uploaded .pbix file for detailed steps.
 
Best regards,
Yuliana Gu
Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.