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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
PawelMJ
Regular Visitor

Active Customers - countif used in Power BI

Hi,

 

I'm transfering manual Excel report to Power BI and I have one issue for the time being.

Database has 3 tables: Sales, Data(calendar), Customers.

 

Active Customer, is a customer, which had purchased product:

1. at least in 3 out of 12 last months and 

2. at least in 1 out of 3 last month

 

I though about adding in Customer table column, which will say if customer is Active or not.

 

Thank you for your support !

 

Example table in Excel below:

Customer190119021903190419051906190719081909191019111912 Purchase in last 12 months >= 3Purchase in last 3 months >= 1Active
A $          10 $          10 $          10 $          10 $          10 $          10 $           -   $          10 $           -   $           -   $          10 $          10 92YES
B $           -   $           -   $           -   $           -   $           -   $           -   $          10 $           -   $          10 $           -   $           -   $           -   20NO
C $          10 $           -   $           -   $           -   $           -   $          10 $           -   $           -   $           -   $           -   $           -   $          10 31YES
6 REPLIES 6
Anonymous
Not applicable

Hi @PawelMJ ,

 

If you already did that column that can help a lot in the measure complexity.

 

Having that column you only have to use Calculate(count('Customers'[ID]),[Active]="YES")

 

Let me know if it helped, if so mark as solution.

 

Best Regards,

Duarte Raminhos

Thank you for your replay.

 

The problem is, that I can't find any simple solution to make logic behind this colum. So I haven't created it. This is the issue.

 

BR,

Pawel

Anonymous
Not applicable

Oh alright I dind't get it.

 

To simplify things you can create both columns like:

 

3 months = if(now()-90<=[Date],1,0) to assign a flag to every entry.

1 Month =  if(now()-30<=[Date],1,0) to assign a flag to every entry.

 

Then last if:

Active/Inactive = if(and([3 months]=1,[1 Month]=1,"Active","Inactive")

 

To count the active orders use a measure that goes like:

measure = calculate(count([orderID]),Active/Inactive="Active")

 

With this logic you're categorizing every order and when you do the visual every customer that counts 0 is inactive and it will only consider the orders you really want.

 

Let me know if it helped.

 

Best Regards,

Duarte Raminhos

 

Simple, but unfortunately, won't work.

 

With this approach, we have information for today.

If we want to see active customers in last month or 6 month ago, it won't work.

 

 

Anonymous
Not applicable

Could you provide a sample of your data model so I can understand what paths you have available?

 

Best Regards,

Duarte Raminhos

I've created sample of data model. Hope that this will help you to understand the problem.

 

 
 

DataModelSampleDataModelSample

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.