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
Anonymous
Not applicable

Dax or Var formula for multiple if statements for Churn

Hi All,

 

I am loolking to create an IF statement for customer churn based on 3,6,9 months. Examaple below:

 

IF, 3 months with 0 Rev, then"At Risk 1"

IF, 6 months with 0 Rev, then"At Risk 2"

IF, 9 months with 0 Rev, then"At Risk 3"

IF, OVER 9 months with 0 Rev, then"Churned Customer"

 

If Statement.png

 

 

1 REPLY 1
bhanu_gautam
Super User
Super User

@Anonymous , Please try below formula to calulate revenue and categorize it

 

CustomerChurnStatus =
VAR CustomerID = 'YourTableName'[CustomerID] -- Replace 'YourTableName' with the actual name of your table
VAR CurrentDate = TODAY()

-- Calculate total revenue for the last 3, 6, and 9 months for the customer
VAR RevenueLast3Months =
CALCULATE(SUM('YourTableName'[Revenue]), FILTER('YourTableName', 'YourTableName'[CustomerID] = CustomerID && 'YourTableName'[Date] >= CurrentDate - 90 && 'YourTableName'[Date] < CurrentDate))

VAR RevenueLast6Months =
CALCULATE(SUM('YourTableName'[Revenue]), FILTER('YourTableName', 'YourTableName'[CustomerID] = CustomerID && 'YourTableName'[Date] >= CurrentDate - 180 && 'YourTableName'[Date] < CurrentDate))

VAR RevenueLast9Months =
CALCULATE(SUM('YourTableName'[Revenue]), FILTER('YourTableName', 'YourTableName'[CustomerID] = CustomerID && 'YourTableName'[Date] >= CurrentDate - 270 && 'YourTableName'[Date] < CurrentDate))

RETURN
IF (
RevenueLast3Months = 0,
"At Risk 1",
IF (
RevenueLast6Months = 0,
"At Risk 2",
IF (
RevenueLast9Months = 0,
"At Risk 3",
IF (
RevenueLast9Months > 0,
"Active Customer",
"Churned Customer"
)
)
)
)

 

Accept as solution and give kudos if it helps




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.