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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
m_richardson
Frequent Visitor

Custom Column: Status based on future transactions

Hi

 

I have a table that contains data that looks like this:

 

m_richardson_1-1670838727688.png

Where I am tracking monthly transactions by Customer.  I've included the first day of the month to aid sorting etc. 

 

What I'd like to do is to apply a custom column to this so I can derive an activity status for each customer by month.  So, for example:

 

If the customer has transacted = 'active'

If they have not transacted = 'inactive (x)' - where x is the number of months they have been inactive for

If they have transacted again after at least one inactive month = 'reactivated'

 

The output would look something like this:

 

m_richardson_3-1670839039719.png

 

I'm assuming DAX is the best method to do this but I'm a little stuck as to where to start.  Any help gratefully received.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@m_richardson , you need new column like

 

var _max = maxx(filter(Table, Table[Customer ID] = earlier([Customer ID]) && [First Day Month] < earlier([First Day Month])),[First Day Month])
var _value = maxx(filter(Table, Table[Customer ID] = earlier([Customer ID]) && [First Day Month]=_max),[Transactions])
return
Switch( True(),
isblank(_max) && isblank([Transactions]), "Inactive",
isblank(_max) && not(isblank([Transactions])), "active",
not(isblank(_max)) && (isblank(_value)) && not(isblank([Transactions])), "reactive",
not(isblank([Transactions])), "active",
"Inactive"
)

 

 

for inctive count you need

Continuous streak : https://youtu.be/GdMcwvdwr0o

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

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@m_richardson , you need new column like

 

var _max = maxx(filter(Table, Table[Customer ID] = earlier([Customer ID]) && [First Day Month] < earlier([First Day Month])),[First Day Month])
var _value = maxx(filter(Table, Table[Customer ID] = earlier([Customer ID]) && [First Day Month]=_max),[Transactions])
return
Switch( True(),
isblank(_max) && isblank([Transactions]), "Inactive",
isblank(_max) && not(isblank([Transactions])), "active",
not(isblank(_max)) && (isblank(_value)) && not(isblank([Transactions])), "reactive",
not(isblank([Transactions])), "active",
"Inactive"
)

 

 

for inctive count you need

Continuous streak : https://youtu.be/GdMcwvdwr0o

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

Hi @amitchandak - this works for active and inactive, but not reactivated for some reason.

Apologies - please ignore, I managed to get it to work.  Great solution (and I learned something about the EARLIER function as well, so that's a bonus).

 

Thanks!

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.