The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I have two tables:
Simple visualization:
Table_1 and Table_2 are related, many-to-many via a bridging table (distinct on ID). I can't seem to find the right set of functions to get me the value I want. Any help greatly appreciated!
Thanks in advance.
Solved! Go to Solution.
Hey,
I'm using the following DAX statement to create a calculated column in Table_2, maybe this is already sufficient and it's not necessary to create a Table_3:
Last Revision Number = var thisID = 'Table_2'[ID] var thisDate = 'Table_2'[Date] return MAXX( TOPN( 1 ,FILTER( ALL('Table_1') ,'Table_1'[ID] = thisID && 'Table_1'[Changed_Date] <= thisDate ) ,'Table_1'[Changed_Date] ,DESC ) ,[Revision Number] )
Please be aware that I'm using <= instead of just < because there is no revision number before 2018-11-01.
Regards,
Tom
Hi @Aidan,
By my tests, the solution of TomMartens should be helpful.
If you have solved your problem, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.
If you still need help, please feel free to ask.
Best Regards,
Cherry
Hey,
I'm using the following DAX statement to create a calculated column in Table_2, maybe this is already sufficient and it's not necessary to create a Table_3:
Last Revision Number = var thisID = 'Table_2'[ID] var thisDate = 'Table_2'[Date] return MAXX( TOPN( 1 ,FILTER( ALL('Table_1') ,'Table_1'[ID] = thisID && 'Table_1'[Changed_Date] <= thisDate ) ,'Table_1'[Changed_Date] ,DESC ) ,[Revision Number] )
Please be aware that I'm using <= instead of just < because there is no revision number before 2018-11-01.
Regards,
Tom
That's brilliant. Thanks very much!