Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
segmentread01
Regular Visitor

dax RFM recency add last purchase date to table variable

Hi there, here is the brief introduction for my question: 

I have a main table [user-events] with user id, purchase date, product id etc.. I was trying to build up a RFM dashboard that allows to filter corresponding R, F, M values according to selected date : 

(image of simplified RFM dashboard. With the "problematic" measure lastPurchaseDate )

measure desktop.PNG

Here is how I build up the dashboard:

First, I built up an aggregated RFM table with groupby() function on monetary values, it works fine (see #monetary below).

Then, I tried to calculate the lastPurchaseDate and attach the measure to my table variable (monetaryPerMonth), it seems wrong.

measure last purchase.PNG

So, my questions is, how to add a last purchase date to [R F M aggregate] table, with blank values replaced by [purchase month] ?

1 REPLY 1
amitchandak
Super User
Super User

@segmentread01 , In term of new column


Last purcahse = maxx(filter(Table, [User ID] = earlier([User id]) && [Purchase Date] < earlier([Purchase Date]) ), [Purchase Date])


Lastest purcahse = maxx(filter(Table, [User ID] = earlier([User id]) ), [Purchase Date])


Measure

Lastest purcahse = maxx(filter(allselected(Table), [User ID] = Max([User id]) ), [Purchase Date])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors