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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Lumegu
Frequent Visitor

Obtain date from different table

Dear community,

 

I have the following issue for which I hope one of you could perhaps help me out:

 

There are two data sets:

1. Contains items:

ItemStatus itemDue date activity B (to be calculated)
Item 1In progress1-12-2021
Item 2In progress13-12-2022

 

2. Contains activities to these items

ItemActivityStatus activityDue date activity
Item 1In progress1-1-2022
Item 1BIn progress1-12-2021
Item 1CIn progress1-10-2021
Item 1DIn progress2-12-2021
Item 1EDone3-12-2021
Item 2AIn progress1-1-2022
Item 2BDone13-12-2022
Item 2CDone1-10-2021

 

I would like to obtain the due date for activity B (dataset activities) for each item in the items dataset (Due date activity B (to be calculated)). I was wondering how to formulate this (vlookup type of calc) into a DAX formula?

1 ACCEPTED SOLUTION
smpa01
Super User
Super User

@Lumegu  try this measure

Measure = CALCULATE(MAX('Table 2'[Due date activity]),FILTER('Table 2','Table 2'[Activity]="B"))

 

smpa01_0-1641415733073.png

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

View solution in original post

2 REPLIES 2
VahidDM
Super User
Super User

Hi @Lumegu 

 

If you want to add a column to your table 1, try this code to add a calculated column:

 

Due date activity B =
CALCULATE (
    MAX ( 'Table 2'[Due date activity] ),
    FILTER (
        'Table 2',
        'Table 2'[Activity] = "B"
            && 'Table 2'[Item] = EARLIER ( 'Table'[Item] )
    )
)

 

output:

VahidDM_0-1641425758127.png

 

 

 

if you want a measure, use @smpa01  solution.

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

smpa01
Super User
Super User

@Lumegu  try this measure

Measure = CALCULATE(MAX('Table 2'[Due date activity]),FILTER('Table 2','Table 2'[Activity]="B"))

 

smpa01_0-1641415733073.png

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

Top Solution Authors