Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi everyone,
I want to use dynamic time period to categorize user retention, with table period_time, with the value of the period_date column is 1, 7, 14, 30, 45, 60, 90 respectively.
I wrote the dax function as follows:
Customer_Classification =
VAR TimeDifference = DATEDIFF(order_detail[Last_purchase_date], order_detail[created_at_local], DAY)
RETURN
SWITCH(
TRUE(),
ISBLANK(order_detail[Last_purchase_date]), "New",
TimeDifference <= SELECTEDVALUE(period_time[period_date]), "Retained",
TimeDifference > SELECTEDVALUE(period_time[period_date]), "Resurrected",
"Unknown"
)
But it doesn't work, the result is time period = 1, even though I have chosen a different time period value.
Please advise me how to make it work and how to create table relationship (if any). Thanks all
@dungluu302 this has the answer to your question. Dynamic segmentation – DAX Patterns
👉 Learn Power BI and Fabric - subscribe to our YT channel - @PowerBIHowTo
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Hi @parry2k , Thanks for your suggestion, but with my newbie level, I still can't clear how to apply your example to my case. If you don't mind, can you guide me?
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!