Forum Discussion
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.
Thank you for your help
5 Replies
- amitchandak
Super User
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])
- Spotto
Helper IV
thanks amitchandak for the help but it didn't work, I'll put the link to the power bi file with your suggestion. Could you please check?
https://drive.google.com/file/d/1Sm6jmkDKnbBpANWUrj3vzHO1sT0zfu4e/view?usp=sharing
- v-jianboli-msft
Community Support
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 visualOutput:
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
Helper 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
- v-jianboli-msft
Community Support
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.