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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
rflipper
Frequent Visitor

Calculate churn rate - Except function

Hello, 

 

I have the following data structure: 

Table: transactions

Ref - Subscription reference 

Date - Date of the order

 

I want to calculate some key metrics, for example, churn rate or count of new users. To achieve this, I need to get data for the previous period and compare it to the current period. In SQL I can do left/right join but in DAX I cannot figure out how to use Except function correctly. 

 

 

Looks like it works for new subscriptions, but if I cannot figure out how to change it to find lost subscriptions: 

 

 
NewSubscriptions = 
IF(
	ISFILTERED('transactions'[Date]);
	ERROR("Time intelligence quick measures can only be grouped or filtered by the Power BI-provided date hierarchy or primary date column.");
        VAR _CURRENT = CALCULATETABLE(DISTINCT(transactions[Ref]);FILTER(transactions;transactions[Date]))
	VAR _PREV = CALCULATETABLE(DISTINCT(transactions[Ref]);DATEADD('transactions'[Date].[Date]; -1; MONTH))
	RETURN
        COUNTROWS(EXCEPT(_CURRENT;_PREV))
)
 
 
1 ACCEPTED SOLUTION
rflipper
Frequent Visitor

Looks like I figured out how to make it works: 

 

NewSubscriptions = 
IF(
	ISFILTERED('transactions'[Date]);
	ERROR("Time intelligence quick measures can only be grouped or filtered by the Power BI-provided date hierarchy or primary date column.");
        VAR _CURRENT = CALCULATETABLE(DISTINCT(transactions[Ref]);FILTER(transactions;transactions[Date]))
	VAR _PREV = CALCULATETABLE(DISTINCT(transactions[Ref]);DATEADD('transactions'[Date].[Date]; -1; MONTH))
	RETURN
        COUNTROWS(EXCEPT(_CURRENT;_PREV))
)
LostSubscriptions = 
IF(
	ISFILTERED('transactions'[Date]);
	ERROR("Time intelligence quick measures can only be grouped or filtered by the Power BI-provided date hierarchy or primary date column.");
        VAR _CURRENT = CALCULATETABLE(DISTINCT(transactions[Ref]);FILTER(transactions;transactions[Date]))
	VAR _PREV = CALCULATETABLE(DISTINCT(transactions[Ref]);DATEADD('transactions'[Date].[Date]; -1; MONTH))
	RETURN
        COUNTROWS(EXCEPT(_PREV;_CURRENT))
)

View solution in original post

1 REPLY 1
rflipper
Frequent Visitor

Looks like I figured out how to make it works: 

 

NewSubscriptions = 
IF(
	ISFILTERED('transactions'[Date]);
	ERROR("Time intelligence quick measures can only be grouped or filtered by the Power BI-provided date hierarchy or primary date column.");
        VAR _CURRENT = CALCULATETABLE(DISTINCT(transactions[Ref]);FILTER(transactions;transactions[Date]))
	VAR _PREV = CALCULATETABLE(DISTINCT(transactions[Ref]);DATEADD('transactions'[Date].[Date]; -1; MONTH))
	RETURN
        COUNTROWS(EXCEPT(_CURRENT;_PREV))
)
LostSubscriptions = 
IF(
	ISFILTERED('transactions'[Date]);
	ERROR("Time intelligence quick measures can only be grouped or filtered by the Power BI-provided date hierarchy or primary date column.");
        VAR _CURRENT = CALCULATETABLE(DISTINCT(transactions[Ref]);FILTER(transactions;transactions[Date]))
	VAR _PREV = CALCULATETABLE(DISTINCT(transactions[Ref]);DATEADD('transactions'[Date].[Date]; -1; MONTH))
	RETURN
        COUNTROWS(EXCEPT(_PREV;_CURRENT))
)

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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