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
Jess123
New Member

Assign COUNTIF to row range (number of customers per number of transactions intervals)

Hi, community,

 

I have a sales table, in which each row indicates a transaction.

My end goal is to be able to show a consolidation of the number of customers in each fixed transaction range, exemplified in the "Number of transactions" column below. 

 

Number of transactionsNumber of customers
1 
2 
3 
4 
5 
6 
7 
8 
9 
>=10 

 

--

 

Let's look at the sample data:

 

1) This is a sales table, with 81 transactions and 8 different customers in a determined period

 

Customer NameTransaction DateTransaction #
A20/01/2023X1262
A28/02/2023X1718
B03/02/2023X1426
C09/02/2023X1496
D09/02/2023X1508
E25/01/2023X1311
E27/01/2023X1334
E27/01/2023X1336
E02/02/2023X1414
E07/02/2023X1478
F15/02/2023X1574
F17/02/2023X1613
F02/03/2023X1762
G10/01/2023X1181
G23/01/2023X1282
G23/01/2023X1283
G31/01/2023X1362
G31/01/2023X1363
G13/02/2023X1536
G13/02/2023X1537
G22/02/2023X1645
G01/03/2023X1745
G01/03/2023X1746
G17/01/2023X1227
H07/02/2023X1459
H27/02/2023X1543

 

2) If I was to do this in excel, I'd create an intermediate table with the number of transactions per customer

 

A2
B1
C1
D1
E5
F3
G11
H

2

 

3) And then I'd use another CountIF to aggregate the number of customers per number of transactions

 

Number of transactionsNumber of customers
13
22
31
40
51
60
70
80
90
>=101

 

Seems very basic, but I didn't manage to do this 3rd step in PowerBI and it's been a few hours now 😞

1 ACCEPTED SOLUTION
wdx223_Daniel
Super User
Super User

Number Of Customer=COUNTROWS(FILTER(SUMMARIZE(Sales,Sales[Customer Name],"@cnt",COUNTROWS(Sales)),[@cnt]=MAX(DimTable[Number of Transactions]))

View solution in original post

2 REPLIES 2
wdx223_Daniel
Super User
Super User

Number Of Customer=COUNTROWS(FILTER(SUMMARIZE(Sales,Sales[Customer Name],"@cnt",COUNTROWS(Sales)),[@cnt]=MAX(DimTable[Number of Transactions]))

Thanks! That worked (:

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

Top Solution Authors