Forum Discussion

cwnoll's avatar
cwnoll
Frequent Visitor
6 years ago
Solved

Help with new column - please!!

I am trying to update a new column in tableA, with data from tableB. what i am attempting to do looks like this (yes i know very simple for most everyone but me)

if 'tableA'[date] is between 'tableB'[StartDate]&&'tableB'[EndDate] then 'tableB'[datePeriod]

 

can anyone help?

thank you in advance

 

 

  • Hi cwnoll ,

     

    We can create the column using following DAX to meet your requirement.

     

    Column =
    AVERAGEX (
        FILTER ( TableB, AND ( [StartDate] <= [Date], [EndDate] >= [Date] ) ),
        [datePeriod]
    )

     

     

    BTW, pbix as attached.

     

    Best regards,

     

    Community Support Team _ DongLi
    If this post helps, then please consider Accept it as the solution to help the other members find it more

2 Replies

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

    Hi cwnoll ,

     

    We can create the column using following DAX to meet your requirement.

     

    Column =
    AVERAGEX (
        FILTER ( TableB, AND ( [StartDate] <= [Date], [EndDate] >= [Date] ) ),
        [datePeriod]
    )

     

     

    BTW, pbix as attached.

     

    Best regards,

     

    Community Support Team _ DongLi
    If this post helps, then please consider Accept it as the solution to help the other members find it more

  • Hello,

     

    please provide some copyable sample data. :smileyhappy:

    Because without the sample my answer may be wrong. 

     

    I would create a calculated column in tableA and use the related funnction to receive the dates from table b. This would be wrapped in a If/Else statement. -> But this only works with propper relationships between Table_A and Table_B therefore please provide us a sample.

     

    If this post was helpful please kudo/mark it :-)

     

    Have a nice day cwnoll !

     

    BR,

    Josef