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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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