I personally try to avoid multi directional relationships where ever possible. Do you think they are absolutely necessary here? You’ll find you’ll be compensating everywhere in your measures if you leave it like this.
Thank you Sam. It is working on most situations and I have removed the bi-direction. It is not filtering multiple customers. See below screenshots. It works for All Customers and selection of 1 Customer, but not filtering multiple customers
That seems odd. It should be working. Based on what the formula and model looks like, unless I’m missing something.
Which client actually had the last sale and was there any amount attached to it from this example?
The formula will be looking at a filtered table for all those customers. Then seeing which was the last day a sale occurred across all of them, and then summing up the total sales only for that last day.
Can we break it down a bit, and look to audit which customer had the last sale out of that selection and then work out what day it was on.
Just another big recommendation here…auditing things like this are simplified immensely when the model is set out in a intuitive way as I go through in the advanced modeling course.
If you have some spare minutes to set it up like this is will help a lot with this one. Chrs
Hi Sam, I have complete the Advanced Data Modelling Course.
The data source I’m sharing is the Demo Company in Xero Accounting. The difference I have with your course is that the sales table does not have a date column. But it does have a pointer to the Journals table. Then the Journals tables has a pointer to the Invoices table wit the sales date I need, plus the relationship to the Customers.
In summary it would be terrific if I could bang together the Invoices, Journals and Sales table together. I tried this using merge in the Query Editor but I couldn’t load the model. As the tables with proper clients are all holding over 500k in rows each. It could not handle the load of matching them all up… I just received errors. So instead reverted back to to having my data model flow through with relationships.
But I wonder, if this is the problem because Customers is coming through Invoices and Sales is coming through Journals…
Hi Sam, in testing I think your formula is in fact working. When multi selecting customers I’m getting some unusual behaviour where it works on some customers and not on others. The Measure is great and I believe unrelated.
Would still love to hear you opinion on the model though. To have the Invoices - Journals - Sales table line. Is there any reason why this is a problem? I should still be able to slice and dice by Date, Customer, Salesperson etc…
Here are my thoughts. (I can’t do anything in the query editor unfortunately due to credentials)
If possible I would attempt to merge Journals with Sales/Expenses/Direct Costs/Other Income. I’m see that the table are only 300 row long. Is that right?
I find merges work well even on relatively large data sets
I’ve checked the formula also and I think it works. There just some clients who have 0.00 as the last sale amount. If one of those client is in the selection and they have the last sale date then that’s why it returns 0.00 I believe
This is how I check below creating a table of last sale amount by customer. Then I ran a few scenarios. It seemed to work as expected based on the data in the table.
Ok, thank you Sam. I will give merging in the query editor another go. Merging previously was not a good outcome. As this is just the Xero Demo Company with only 300 rows. The rows with clients were carrying over 500k in rows for each table. It was not coping and crashed/timed out during long waits.
Which is why I was hoping I could simply pass the relationships through the tables in the model, but if you think my DAX measures will be compromised/limited with this structure, I will continue testing/refining the model.
This is normal behavior of a subsidiary ledger. The Sales Table will represent the Accounts Receivables Subsidiary ledger holding invidual invoice items. The Journals refer to the general ledger only and not customers which holds the value only and is what the trial balance is based on.
I have found it useful to pull that FACT data for each ledger in group . ie General Ledger/Journal Transactions, Sales Invoices, Purchase Invoices etc.
Perhaps post an image of your data model. Have you created your own separate Date table?
I’m really sorry I missed this response from you. I did not receive an email notification telling me that you had contributed. Only a notification on the Enterprise Forum when I logged back in, which is the reason for the delay in more response.
I have created my own date table… (It is the Date Table Sam has shared, with the addition of financial year columns by month, year & quarter).
I am now getting the correct behaviour for Last Sale Amount after using Sam’s new DAX Expression.