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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
ebeauchamp
Helper I
Helper I

Count Leavers based on conditions (revenue this period and previous period)

Hi everyone,

 

I am trying to do a distinct count of leaving customers that match two criterias: had a revenue > 0 in the previous period, and is at 0 in this period. Can't get the right syntax so thanks for your help!

For other needs, the time periods work well with the date slicer on the page, and are measured like this:

This Period Revenue = SUM(Transactions[DailyUsage$])

 

Previous Period Revenue = CALCULATE(SUM(Transactions[DailyUsage$])
,DATESBETWEEN(
Dates[Date],
[Start of Previous Period],
[End of Previous Period]),
ALL(Dates) )

 

This measure is also working well:
CountOrganizations = CALCULATE(DISTINCTCOUNT(Transactions[OrganizationUniqueName]))

 

It's when trying to add conditions to this count that I can't get it to work. Example tried from seeing other posts:
CountLeavers = CALCULATE(DISTINCTCOUNT(Transactions[OrganizationUniqueName]),FILTER(ALL(Transactions),[Previous Period Revenue]>0,[This Period Revenue]=0))

Any idea on how to make it work? Thanks

 

1 ACCEPTED SOLUTION
v-easonf-msft
Community Support
Community Support

Hi, @ebeauchamp 

Due to filters interfering with each other ,it maybe failed to get correct figure.

I think if  other measures work well, you'd better to use these  measures as variables in measure “CountLeavers”, similar to the following:

CountLeavers= 
var  _This_Period_Revenue = SUM(Transactions[DailyUsage$])
var  _Previous_Period_Revenue = CALCULATE(SUM(Transactions[DailyUsage$])
,DATESBETWEEN(
Dates[Date],
[Start of Previous Period],
[End of Previous Period]),
ALL(Dates) )
Return
CALCULATE(DISTINCTCOUNT(Transactions[OrganizationUniqueName]),FILTER(ALL(Transactions),_Previous_Period_Revenue>0,_This_Period_Revenue=0))

If it doesn't meet your requirement, kindly share your sample data and expected result if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.

 

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

1 REPLY 1
v-easonf-msft
Community Support
Community Support

Hi, @ebeauchamp 

Due to filters interfering with each other ,it maybe failed to get correct figure.

I think if  other measures work well, you'd better to use these  measures as variables in measure “CountLeavers”, similar to the following:

CountLeavers= 
var  _This_Period_Revenue = SUM(Transactions[DailyUsage$])
var  _Previous_Period_Revenue = CALCULATE(SUM(Transactions[DailyUsage$])
,DATESBETWEEN(
Dates[Date],
[Start of Previous Period],
[End of Previous Period]),
ALL(Dates) )
Return
CALCULATE(DISTINCTCOUNT(Transactions[OrganizationUniqueName]),FILTER(ALL(Transactions),_Previous_Period_Revenue>0,_This_Period_Revenue=0))

If it doesn't meet your requirement, kindly share your sample data and expected result if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.

 

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.