Forum Discussion

Spotto's avatar
Spotto
Icon for Helper IV rankHelper IV
4 years ago

Get the Same or Previous Date- Help

Hello everyone, I have a TABLE A where I have a date, I need to get the TRAVA field of TABLE B with the date equal to or before the date of table A
I am not able to find a solution for this.

 

 

 

Example Power Bi 

 

Thank you for your help

5 Replies

  • Spotto , A new column in Tbale A

     

    New column =

    var _max  = maxx(filter(TableB, TableB[Contrado] = TableA[Contrado] && TableB[Date] <= TableA[Date]), TableB[Date])

    return

    maxx(filter(TableB, TableB[Contrado] = TableA[Contrado] && TableB[Date] =_max ), TableB[TRAVA])

  • Hi Spotto ,

     

    Please try:

    Create a measure:
    
    Measure = MAXX(FILTER('TABLE B',[CONTRATO]=MAX('TABLE A'[CONTRATO])&&[DATA]<=MAX('TABLE A'[DATA])),[TRAVA])
    
    Then Apply it to the visual

    Output:

     

    Best Regards,

    Jianbo Li

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • Spotto's avatar
      Spotto
      Icon for Helper IV rankHelper IV

      thanks for the help but I needed to return the same date or before the date. In the example contract 222b has the date jan/05, the same or earlier date would be jan/03 and the result would be F

       

       

  • Hi Spotto ,

     

    Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or if you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file after removing sensitive data.

    Refer to:

    How to provide sample data in the Power BI Forum

    How to Get Your Question Answered Quickly

     

    Best Regards,

    Jianbo Li

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.