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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
donovanbush
Regular Visitor

Count of Active Companies Help

Hi everyone, 

 

I'm new(ish) to Power BI and I'm trying to create a report for my company to look at how many Active companies we add by month. I have a table that I'm pulling in from an OData feed with the system we are working with. Here's an example that went wrong when doing a simple count of Active CompanyStatus (there is another column for the company ID, joined with a master company table):

 

donovanbush_0-1685042365677.png

 

NSF is still technically an active company status, so when the field is switched back to Active on 4/18/2023, it counts that as a new addition in both March (from the 3/3/2022 entry) and April (from 4/18/2023). Is there a way I can make it only count once, unless there is a Termination status (i.e. Terminated/TermwithAccess in my table) in between the two Active statuses, in that instance it should be counted twice. 

 

Thank you so much for the help! I can provide more info as needed.

 

-Don

 

2 REPLIES 2
amitchandak
Super User
Super User

@donovanbush , two measures like these

 

Max Status = calculate(lastnonblankvalue(Table[Effective Date], max(Table[CompanyStatus])), filter(allselected(Table) , Table[Company] = max(Table[Company]) && Table[Effective Date] <= max(Table[Effective Date]))

Active Company = countx( filter(Values(Table[Company]), [Max Status] in {"Active"}), Table[Company])

@amitchandak Thank you!

 

So, when I use those two measures and check the work by outputting a table, this is what I get: 

 

donovanbush_2-1685111846703.png

 

 

But in my table it appears like this: 

 

donovanbush_1-1685111510347.png

 

 

So in this instance, only the 3/3/2022 date should be the real Active date, because the second Active date comes after an Active status (NSF or Inactive are both still Active). When I visualize the data, I'm still getting too high of a count because it's double counting these. Now, if the NSF was a Terminated status (Terminated or TermwithAccess), the Active date both before and after because they are two separate additions. 

 

Essentially, if there's a Termination for a company, and two Active statuses (one before and one after), we want both of those Active status dates, but if there's no Termination statuse and two (or more) Active statuses, we want only one, the earliest one. 

 

I apologize if I'm not being clear enough, this problem seems a little abstract for me with my understanding of Power BI. I hope this helps! 

 

-Don

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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