cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
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
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

Helpful resources

Announcements
secondImage

Happy New Year from Power BI

This is a must watch for a message from Power BI!

December Update

Check it Out!

Click here to read more about the December 2020 Updates!

Community Blog

Check it Out!

Click here to read the latest blog and learn more about contributing to the Power BI blog!

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors
Top Kudoed Authors