Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi.
I have two tables. One named External_Contact which contains customers and one table named G_MainL which contains invoices and a column named paydate.
They are connectd with columns Kundenr and Contid one-to-many.
I need a column in External_Contact that show the last payment date for each customer.
I have tried the following for a new column but get an error.
last_payment = LOOKUPVALUE(Max(G_MAINL[Paydate]); External_Contact[Kundenr]; G_MainL[Contid])
I get the error: " Lookupvalue expects a column reference as argument number 1."
what am I doing wrong?
Thank you for your help.
Solved! Go to Solution.
Hi @Joernolav
Since you have a relationship between the two tables, you can use this formula as a calculated column in External_Contact:
last_payment = CALCULATE ( MAX ( G_MainL[Paydate] ) )
Since this is calculated within the row context of External_Contact, the CALCULATE results in context transition, effectively adding the current row's customer to the filter context, which in turn filters G_MainL.
MAX ( G_MainL[Paydate] ) is then evaluated over the rows of G_MainL corresponding to that customer.
Cheers,
Owen
Hi @Joernolav
Since you have a relationship between the two tables, you can use this formula as a calculated column in External_Contact:
last_payment = CALCULATE ( MAX ( G_MainL[Paydate] ) )
Since this is calculated within the row context of External_Contact, the CALCULATE results in context transition, effectively adding the current row's customer to the filter context, which in turn filters G_MainL.
MAX ( G_MainL[Paydate] ) is then evaluated over the rows of G_MainL corresponding to that customer.
Cheers,
Owen
Thank you. That solved the problem.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |