Forum Discussion
Only showing the latest seller while using the LASTDATE function
Hi!
I have a large database that I've imported to Power BI via a csv file. I'd like to show the customers that haven't made a new order in for example one year, and show that specific date and the salesperson of that order.
I used LASTDATE function with my measure for the Latest invoice column and it works fine, but when I add the seller data it shows every seller's last sale for that customer. I want to only show the latest invoice date, no matter the salesperson.
Cheers,
Joni
2 Replies
- Greg_Deckler
Community Champion
Can you provide sample data? I have a recipe for lost customers in my book, it is fairly straight-forward. There is a whole chapter on customer KPI's. This should get you started. https://community.powerbi.com/t5/Quick-Measures-Gallery/New-and-Returning-Customers/m-p/168297#M13
It has similar techniques.
- amitchandak
Super User
something like this should work in the context with a date calendar
Last date = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Date]=max('Date'[Date])))
Last date = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Date]=lastdate('Date'[Date])))