Count Number of Repeat Customers

a68tbird

New Member
Joined
Nov 15, 2011
Messages
49
Office Version
  1. 365
Platform
  1. Windows
Hello all -

Having some trouble wrapping my head around this. I would like to count the number of repeat customers in my Orders table. The customer email is the unique value to count. I want to be able to use this calculation to create a table such as the one represented below:

a68tbird_0-1696442632932.png


The conditional formatting I should be able to figure out, but I'm not sure how to create the DAX for this. It needs to be able to identify repeat emails, and the number of times it repeats. Filter context for the YEAR should occur in the table - that is, the DAX shouldn't need to consider the year - just the entire Orders table. This way, if I want to look at all years, or drill down to quarters and months, it should still return the relevant results. Will it require five different measures - one for each bin of "# of Orders"?
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Hello all -

Having some trouble wrapping my head around this. I would like to count the number of repeat customers in my Orders table. The customer email is the unique value to count. I want to be able to use this calculation to create a table such as the one represented below:

a68tbird_0-1696442632932.png


The conditional formatting I should be able to figure out, but I'm not sure how to create the DAX for this. It needs to be able to identify repeat emails, and the number of times it repeats. Filter context for the YEAR should occur in the table - that is, the DAX shouldn't need to consider the year - just the entire Orders table. This way, if I want to look at all years, or drill down to quarters and months, it should still return the relevant results. Will it require five different measures - one for each bin of "# of Orders"?
MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
 
Upvote 0
MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
I hope this works for you. This is 6800+ rows of data - all orders from this year - with order date and I used zip code so as to not expose personal emails.

N0P 2L0


Thanks!
 
Upvote 0
I hope this works for you. This is 6800+ rows of data - all orders from this year - with order date and I used zip code so as to not expose personal emails.

N0P 2L0


Thanks!
This is all that I get : N0P 2L0

Did you select the entire range?
 
Upvote 0
This is all that I get : N0P 2L0

Did you select the entire range?
Apologies - I had not captured the range.

This is now a considerably smaller sample set, which unfortunately doesn't include many duplicates. But hopefully it's something you can work with.

BillingZipPostalCodeDateCompletedGMT
94547-153216-Oct-23
T4V 2K316-Oct-23
N0P 2L016-Oct-23
L7G 5Z116-Oct-23
11215-369716-Oct-23
B0K 2A016-Oct-23
K1Y 3H416-Oct-23
19067-583716-Oct-23
63146-491616-Oct-23
92376-364916-Oct-23
E1B 3R616-Oct-23
T3H 0S916-Oct-23
T3K 5V316-Oct-23
V1N 4V116-Oct-23
V5Y 0B516-Oct-23
V6H 4H416-Oct-23
V1M 3A816-Oct-23
H2H 2B216-Oct-23
60515-141316-Oct-23
N4G 2B716-Oct-23
L9G 0E416-Oct-23
K1C 7G716-Oct-23
L9C 4Y816-Oct-23
L1N 8M616-Oct-23
M4E 2T816-Oct-23
K4M 1K216-Oct-23
L1X 2R416-Oct-23
M6R 2A416-Oct-23
1524116-Oct-23
L8H 5R415-Oct-23
M8W 0B615-Oct-23
M8W 0B615-Oct-23
L2M 7G614-Oct-23
N3W 1G514-Oct-23
EH4 4GL14-Oct-23
L6Z 3T313-Oct-23
6010712-Oct-23
6045212-Oct-23
38464-654012-Oct-23
9965412-Oct-23
9412312-Oct-23
8904812-Oct-23
35173-113212-Oct-23
1623812-Oct-23
53548-883812-Oct-23
9495412-Oct-23
77845-568512-Oct-23
1240412-Oct-23
1201012-Oct-23
89002-874312-Oct-23
54022-591512-Oct-23
4022312-Oct-23
63028-451012-Oct-23
7522912-Oct-23
3000512-Oct-23
762112-Oct-23
95726-956712-Oct-23
9538212-Oct-23
H8T 2R412-Oct-23
G6P 9Y512-Oct-23
J7Y 0C412-Oct-23
L3X 0K912-Oct-23
M4B 3A412-Oct-23
K9J 6X712-Oct-23
K0G 1L012-Oct-23
8154312-Oct-23
9838312-Oct-23
AB31 6DY12-Oct-23
500012-Oct-23
T6H 3X912-Oct-23
9867212-Oct-23
883312-Oct-23
9826212-Oct-23
BD17 5BN12-Oct-23
1952011-Oct-23
63017-792711-Oct-23
53705-213011-Oct-23
K0C 1M011-Oct-23
76179-760310-Oct-23
48315-211910-Oct-23
48386-305010-Oct-23
1605710-Oct-23
61354-331010-Oct-23
62650-331010-Oct-23
86323-591810-Oct-23
8711210-Oct-23
8264610-Oct-23
38589-170110-Oct-23
55391-163710-Oct-23
9787710-Oct-23
5827110-Oct-23
97470-792410-Oct-23
4001410-Oct-23
29710-649110-Oct-23
9412310-Oct-23
9964510-Oct-23
7100410-Oct-23
35444-105610-Oct-23
2294210-Oct-23
8362210-Oct-23
97219-961610-Oct-23
91016-223810-Oct-23
2723910-Oct-23
2017610-Oct-23
11507-120510-Oct-23
53045-542510-Oct-23
15724-971710-Oct-23
1651010-Oct-23
1805510-Oct-23
9206710-Oct-23
4941210-Oct-23
08054-302310-Oct-23
79707-137310-Oct-23
7604910-Oct-23
5512610-Oct-23
20003-121310-Oct-23
792210-Oct-23
2016910-Oct-23
92562-554310-Oct-23
800410-Oct-23
27608-262910-Oct-23
15044-747310-Oct-23
20194-112210-Oct-23
5276110-Oct-23
78746-643110-Oct-23
74006-683210-Oct-23
808010-Oct-23
4431310-Oct-23
5993710-Oct-23
90064-230110-Oct-23
92867-334610-Oct-23
15044-894610-Oct-23
55418-152510-Oct-23
7050610-Oct-23
9833510-Oct-23
7407310-Oct-23
7631010-Oct-23
6030410-Oct-23
07604-101310-Oct-23
66049-450610-Oct-23
3707210-Oct-23
9836510-Oct-23
5710610-Oct-23
112910-Oct-23
9205710-Oct-23
9202810-Oct-23
39110-951610-Oct-23
18505-264210-Oct-23
2014710-Oct-23
4846110-Oct-23
B3Z 1E610-Oct-23
B0T 1W010-Oct-23
S7H 3B710-Oct-23
T3C 2Z110-Oct-23
T2M 2H810-Oct-23
V6L 1A110-Oct-23
V3S 8V410-Oct-23
J0J 1Y010-Oct-23
H7K 3C110-Oct-23
L9Y 0A310-Oct-23
L2T 3G110-Oct-23
M4J 4S610-Oct-23
M4L 1P410-Oct-23
N3B 3L910-Oct-23
L0B 1B010-Oct-23
M5R 3B210-Oct-23
K0C 2J010-Oct-23
K0K 2T010-Oct-23
4533210-Oct-23
17510-Oct-23
62410-Oct-23
8714410-Oct-23
100010-Oct-23
P0J 1K010-Oct-23
1700310-Oct-23
L4G 5P510-Oct-23
5307010-Oct-23
213910-Oct-23
6006910-Oct-23
8561410-Oct-23
8640310-Oct-23
V7H 2R510-Oct-23
7263410-Oct-23
76667-247810-Oct-23
4054510-Oct-23
3817610-Oct-23
4213510-Oct-23
5823910-Oct-23
2261 BA10-Oct-23
M6E 4X610-Oct-23
420010-Oct-23
T7Z 0A810-Oct-23
2017608-Oct-23
1914408-Oct-23
06850-222107-Oct-23
9011605-Oct-23
01532-231105-Oct-23
75063-535005-Oct-23
154505-Oct-23
20132-383905-Oct-23
6408205-Oct-23
874205-Oct-23
7862605-Oct-23
5531105-Oct-23
9267905-Oct-23
711005-Oct-23
91201-415605-Oct-23
94948-130705-Oct-23
9110705-Oct-23
884005-Oct-23
4575005-Oct-23
2280105-Oct-23
301505-Oct-23
N1 8LH05-Oct-23
12546-452205-Oct-23
7751005-Oct-23
95776-546705-Oct-23
14075-404205-Oct-23
4422105-Oct-23
90232-345305-Oct-23
75783-620004-Oct-23
1903304-Oct-23
61281-859304-Oct-23
681204-Oct-23
6802804-Oct-23
3080904-Oct-23
6703704-Oct-23
02739-106304-Oct-23
3580304-Oct-23
3771604-Oct-23
6813404-Oct-23
85334-134404-Oct-23
9901904-Oct-23
45044-756504-Oct-23
1740204-Oct-23
9456004-Oct-23
6520204-Oct-23
48039-200304-Oct-23
48708-558304-Oct-23
33410-141604-Oct-23
K2G 7E304-Oct-23
421804-Oct-23
NN12 7NB04-Oct-23
CB11 3TH04-Oct-23
2802304-Oct-23
T6R 0W304-Oct-23
20015-270304-Oct-23
49004-965204-Oct-23
106704-Oct-23
912004-Oct-23
422104-Oct-23
7525203-Oct-23
1938003-Oct-23
1070802-Oct-23
1070802-Oct-23
1052202-Oct-23
1002602-Oct-23
1196102-Oct-23
2074430-Sep-23
2060130-Sep-23
2087830-Sep-23
9805930-Sep-23
3350830-Sep-23
3235330-Sep-23
7743329-Sep-23
44273-893429-Sep-23
9231529-Sep-23
9561029-Sep-23
92544-847829-Sep-23
06897-150429-Sep-23
2837429-Sep-23
1003029-Sep-23
44313-508129-Sep-23
7405529-Sep-23
2879229-Sep-23
647829-Sep-23
E3B 4R229-Sep-23
RM16 2RS29-Sep-23
RM16 2RS29-Sep-23
L3Y 5R929-Sep-23
K8V 3A829-Sep-23
4146029-Sep-23
4100328-Sep-23
42501-612628-Sep-23
7407428-Sep-23
2265528-Sep-23
55123-243928-Sep-23
9940328-Sep-23
54484-580128-Sep-23
1822928-Sep-23
32226-188428-Sep-23
4841228-Sep-23
1120128-Sep-23
25414-457828-Sep-23
7245028-Sep-23
564128-Sep-23
540428-Sep-23
1296728-Sep-23
660428-Sep-23
193828-Sep-23
184428-Sep-23
185028-Sep-23
677028-Sep-23
748028-Sep-23
1054928-Sep-23
E3C 1M928-Sep-23
B3R 1K728-Sep-23
N0H 1G028-Sep-23
82228-Sep-23
93228-Sep-23
ME13 8BZ28-Sep-23
WS9 8RF28-Sep-23
444728-Sep-23
9823628-Sep-23
8565828-Sep-23
8092027-Sep-23
94708-172527-Sep-23
4838226-Sep-23
3371526-Sep-23
K0C 1L026-Sep-23
5276126-Sep-23
39051-360726-Sep-23
39042-948826-Sep-23
8412826-Sep-23
2985126-Sep-23
07032-411426-Sep-23
7401426-Sep-23
73132-562126-Sep-23
20105-460026-Sep-23
8353626-Sep-23
80603-942026-Sep-23
1896626-Sep-23
6337926-Sep-23
63129-498526-Sep-23
47918-823926-Sep-23
6018026-Sep-23
6045026-Sep-23
6011026-Sep-23
4351226-Sep-23
32904-733626-Sep-23
32097-567226-Sep-23
33837-585426-Sep-23
3423426-Sep-23
92308-505426-Sep-23
9500826-Sep-23
4985826-Sep-23
4963126-Sep-23
48165-973326-Sep-23
7871726-Sep-23
7970626-Sep-23
7766226-Sep-23
3278026-Sep-23
690326-Sep-23
18914-354926-Sep-23
1121526-Sep-23
8479026-Sep-23
89166-711926-Sep-23
6045126-Sep-23
1600126-Sep-23
852726-Sep-23
1122226-Sep-23
202526-Sep-23
7307226-Sep-23
5370526-Sep-23
1311026-Sep-23
9819926-Sep-23
196026-Sep-23
1344026-Sep-23
4888026-Sep-23
7509326-Sep-23
5531626-Sep-23
76034-581526-Sep-23
9003526-Sep-23
9226026-Sep-23
9203626-Sep-23
9406226-Sep-23
9110326-Sep-23
2541426-Sep-23
22902-610926-Sep-23
01543-177626-Sep-23
S0G 2S026-Sep-23
B2Z 1B926-Sep-23
T6E 3C726-Sep-23
J4P 2M226-Sep-23
323726-Sep-23
N2M 1P726-Sep-23
L0R 2C026-Sep-23
K0K 1T026-Sep-23
350026-Sep-23
313426-Sep-23
514426-Sep-23
3316126-Sep-23
1154026-Sep-23
4410626-Sep-23
28610-830526-Sep-23
97404-216026-Sep-23
97038-962126-Sep-23
641626-Sep-23
98029-570526-Sep-23
98029-570526-Sep-23
9226026-Sep-23
94519-160726-Sep-23
5011126-Sep-23
98270-776625-Sep-23
38028-378125-Sep-23
6527025-Sep-23
8271825-Sep-23
2012925-Sep-23
284225-Sep-23
03864-726825-Sep-23
80013-164125-Sep-23
8063425-Sep-23
6205625-Sep-23
4500525-Sep-23
83445-550025-Sep-23
1865725-Sep-23
3392225-Sep-23
32904-902725-Sep-23
3216825-Sep-23
92562-467025-Sep-23
4945625-Sep-23
4780525-Sep-23
14623-219725-Sep-23
3576125-Sep-23
160625-Sep-23
1151825-Sep-23
3032925-Sep-23
6338525-Sep-23
808025-Sep-23
1304125-Sep-23
708125-Sep-23
5904725-Sep-23
7872925-Sep-23
1205425-Sep-23
3713525-Sep-23
4520825-Sep-23
3506825-Sep-23
291625-Sep-23
7737725-Sep-23
7045825-Sep-23
9137725-Sep-23
9552125-Sep-23
9210425-Sep-23
N6H 1R425-Sep-23
450925-Sep-23
204625-Sep-23
233-001325-Sep-23
9838325-Sep-23
ME5 7RU25-Sep-23
GL6 8JY25-Sep-23
5460125-Sep-23
3523 RH25-Sep-23
2750-56825-Sep-23
R14 AY2025-Sep-23
6152425-Sep-23
351625-Sep-23
6100625-Sep-23
90265-260425-Sep-23
3310425-Sep-23
1043025-Sep-23
4080025-Sep-23
CH62 4SX25-Sep-23
1001823-Sep-23
8536422-Sep-23
9606722-Sep-23
SL2 1TN22-Sep-23
6605422-Sep-23
L7G 5Z121-Sep-23
L7G 5Z121-Sep-23
16720-621621-Sep-23
570121-Sep-23
6126421-Sep-23
4965921-Sep-23
78013-335821-Sep-23
2013221-Sep-23
6060721-Sep-23
4603821-Sep-23
43016-705121-Sep-23
2432621-Sep-23
4446021-Sep-23
4322921-Sep-23
9833221-Sep-23
9740121-Sep-23
2231421-Sep-23
1136321-Sep-23
8505021-Sep-23
872421-Sep-23
8907421-Sep-23
8630521-Sep-23
1946021-Sep-23
1002521-Sep-23
6054621-Sep-23
2820721-Sep-23
80904-216621-Sep-23
1376021-Sep-23
3411321-Sep-23
9990121-Sep-23
9263721-Sep-23
9581821-Sep-23
9350921-Sep-23
9002221-Sep-23
9408021-Sep-23
9206721-Sep-23
9287921-Sep-23
92595-833821-Sep-23
8904421-Sep-23
1137721-Sep-23
1095621-Sep-23
L6J 1K421-Sep-23
610721-Sep-23
15421-Sep-23
5739921-Sep-23
NN15 7BH21-Sep-23
ST17 0JD21-Sep-23
V7R 4B221-Sep-23
01-31821-Sep-23
5560021-Sep-23
L6X 1K621-Sep-23
5510021-Sep-23
2822421-Sep-23
T8G 1G521-Sep-23
43701-905621-Sep-23
80305-601521-Sep-23
620721-Sep-23
SA65 9NR21-Sep-23
05-83021-Sep-23
8565821-Sep-23
2322121-Sep-23
6091120-Sep-23
9933720-Sep-23
8593620-Sep-23
85032-762520-Sep-23
2428320-Sep-23
6611120-Sep-23
36530-371520-Sep-23
9773920-Sep-23
3857120-Sep-23
1905320-Sep-23
18078-275720-Sep-23
33470-616120-Sep-23
7976220-Sep-23
23229-480820-Sep-23
20171-292620-Sep-23
213820-Sep-23
1281620-Sep-23
14220-283720-Sep-23
6061820-Sep-23
4425620-Sep-23
40205-314920-Sep-23
46530-481720-Sep-23
44240-714520-Sep-23
43223-153520-Sep-23
4046120-Sep-23
5385020-Sep-23
B69 1DJ20-Sep-23
SO18 2HE20-Sep-23
4746020-Sep-23
BH9 2JU20-Sep-23
43701-905620-Sep-23
SE4 1YB20-Sep-23
5114919-Sep-23
3370419-Sep-23
3370419-Sep-23
27614-921619-Sep-23
1908619-Sep-23
4806819-Sep-23
46112-813419-Sep-23
9250919-Sep-23
4425619-Sep-23
43202-244219-Sep-23
43214-183219-Sep-23
43004-815119-Sep-23
387819-Sep-23
4545919-Sep-23
1420719-Sep-23
4523319-Sep-23
4411619-Sep-23
44107-552119-Sep-23
46033-889219-Sep-23
2940319-Sep-23
61604-541019-Sep-23
06811-260419-Sep-23
4313019-Sep-23
46220-311819-Sep-23
45244-296119-Sep-23
4515219-Sep-23
4050319-Sep-23
46032-520719-Sep-23
764219-Sep-23
4611219-Sep-23
95691-620919-Sep-23
V3V 5E319-Sep-23
BS24 0PU19-Sep-23
WR3 7TL19-Sep-23
401719-Sep-23
991019-Sep-23
46074-874119-Sep-23
46074-874119-Sep-23
7664319-Sep-23
L7G 5Z118-Sep-23
L7G 5Z118-Sep-23
48207-422018-Sep-23
43787-924718-Sep-23
6135018-Sep-23
9802118-Sep-23
83714-151118-Sep-23
2012918-Sep-23
6406218-Sep-23
82435-926618-Sep-23
4060118-Sep-23
4060118-Sep-23
49720-190018-Sep-23
4105118-Sep-23
4022318-Sep-23
2294218-Sep-23
1894718-Sep-23
9940318-Sep-23
5310518-Sep-23
9839018-Sep-23
3522818-Sep-23
9815518-Sep-23
92544-847818-Sep-23
46112-813418-Sep-23
22101-574818-Sep-23
20876-561018-Sep-23
9827318-Sep-23
4517618-Sep-23
4534218-Sep-23
4909018-Sep-23
5511318-Sep-23
30022-473618-Sep-23
2870118-Sep-23
249318-Sep-23
R3L 1R318-Sep-23
L6J 1K418-Sep-23
2786318-Sep-23
V7R 4B218-Sep-23
3304018-Sep-23
320218-Sep-23
76017-656816-Sep-23
TN2 5LP16-Sep-23
3217415-Sep-23
45011-559215-Sep-23
4808815-Sep-23
78041-191015-Sep-23
535315-Sep-23
2751615-Sep-23
3332214-Sep-23
1623814-Sep-23
8942914-Sep-23
9202414-Sep-23
9860514-Sep-23
1993314-Sep-23
5532114-Sep-23
2077014-Sep-23
4806814-Sep-23
49651-865714-Sep-23
49038-930414-Sep-23
26753-957114-Sep-23
2203914-Sep-23
97756-753314-Sep-23
2017514-Sep-23
22182-171614-Sep-23
07755-111314-Sep-23
20850-375114-Sep-23
4606414-Sep-23
4658114-Sep-23
46220-292414-Sep-23
4603214-Sep-23
3344414-Sep-23
45458-403714-Sep-23
46032-826014-Sep-23
45066-740114-Sep-23
44145-466614-Sep-23
46226-443814-Sep-23
9286614-Sep-23
22724-201814-Sep-23
22039-152814-Sep-23
4515914-Sep-23
4515914-Sep-23
4515914-Sep-23
M1E 5B614-Sep-23
G73 3NX14-Sep-23
2204414-Sep-23
4746014-Sep-23
3001914-Sep-23
48317-343814-Sep-23
4796014-Sep-23
4796014-Sep-23
7810913-Sep-23
7761913-Sep-23
33417-581613-Sep-23
44081-955413-Sep-23
3060613-Sep-23
6301013-Sep-23
59714-404413-Sep-23
28462-333213-Sep-23
875713-Sep-23
06716-292513-Sep-23
 
Upvote 0
this Mcode in Power query will tell you how many times the items in Col A appear.

let
Source = Excel.CurrentWorkbook(){[Name="Table2"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"DateCompletedGMT", type date}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"BillingZipPostalCode"}, {{"Data", each _, type table [BillingZipPostalCode=any, DateCompletedGMT=nullable date]}}),
#"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Table.AddIndexColumn([Data],"Index",1,1)),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Data"}),
#"Expanded Custom" = Table.ExpandTableColumn(#"Removed Columns", "Custom", {"DateCompletedGMT", "Index"}, {"DateCompletedGMT", "Index"})
in
#"Expanded Custom"
 
Upvote 0
Here is another solution that shows the items in column A and the number of visits.

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"DateCompletedGMT", type date}, {"BillingZipPostalCode", type text}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"BillingZipPostalCode"}, {{"Count", each Table.RowCount(_), Int64.Type}}),
    #"Filtered Rows" = Table.SelectRows(#"Grouped Rows", each ([Count] <> 1))
in
    #"Filtered Rows"

BillingZipPostalCodeCount
L7G 5Z15
M8W 0B62
941232
162382
402232
983832
229422
201762
920672
527612
80802
107082
92544-84782
RM16 2RS2
994032
856582
922602
98029-57052
201292
L6J 1K42
V7R 4B22
43701-90562
442562
474602
337042
480682
46112-81342
46074-87412
406012
451593
479602
 
Upvote 0
I'm sure this would be a lot easier with a pivot table and DAX, but I don't know DAX for %$#@.

So here is power query imitating a pivot table.

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    tbl = Table.TransformColumnTypes(Source,{{"Date", type date}}),
    tbl1 = Table.TransformColumns(tbl,{{"Date", Date.Year, Int64.Type}}),
    tbl2 = Table.Group(tbl1, {"CustomerID"}, {{"All", each _}}),
    tbl3 = List.Accumulate({ List.Min(tbl1[Date]) .. List.Max(tbl1[Date]) }, tbl2, (s,c)=> 
        Table.AddColumn(s, Text.From(c), each Table.RowCount(Table.SelectRows([All],(x)=> x[Date]=c)))),
    tbl4 = Table.UnpivotOtherColumns(tbl3, {"CustomerID", "All"}, "Year", "Value"),
    tbl5 = Table.RemoveColumns(tbl4,{"CustomerID", "All"}),
    tbl6 = Table.Group(tbl5, {"Year"}, {{"All", each _}}),
    tbl7 = Table.AddColumn(tbl6, "Customers", each Table.RowCount(Table.SelectRows([All], (x)=> x[Value]>0))),
    tbl8 = List.Accumulate({1..4}, tbl7, (s,c)=> Table.AddColumn(s, Text.From(c) & " Orders", each Table.RowCount(Table.SelectRows([All], (x)=> x[Value] =c))/[Customers], Percentage.Type)),
    tbl9 = Table.AddColumn(tbl8, "5+ Orders", each Table.RowCount(Table.SelectRows([All], (x)=> x[Value] >4))/[Customers], Percentage.Type),
    tbl10 = Table.RemoveColumns(tbl9,{"All"}),
    Result = Table.RenameColumns(tbl10,{{"1 Orders", "1 Order"}})
in
    Result

Customers.xlsx
ABCDEFGHIJK
1Table1Query Output
2DateCustomerIDYearCustomers1 Order2 Orders3 Orders4 Orders5+ Orders
31/31/2021N20212330.43%26.09%13.04%17.39%13.04%
42/14/2021L20222512.00%24.00%24.00%36.00%4.00%
56/15/2022Y2023224.55%40.91%31.82%18.18%4.55%
66/23/2023A
77/30/2021K
811/12/2021J
912/2/2021P
1010/16/2021G
113/17/2023N
1212/1/2022A
133/8/2023O
149/29/2022Q
152/25/2021T
1612/22/2021K
172/23/2023D
189/18/2021N
193/19/2023Z
209/17/2022B
215/13/2022L
2212/19/2021T
237/30/2022E
242/15/2022P
258/10/2021L
2611/7/2022A
2710/8/2021W
283/31/2023V
2912/28/2021R
309/2/2023Z
3110/6/2022F
324/15/2023U
338/22/2023W
342/5/2021V
357/14/2023O
369/25/2021Q
373/27/2023Y
382/21/2023V
395/4/2021Z
409/14/2022J
418/3/2022R
424/12/2022A
437/3/2023K
442/17/2023K
452/16/2022E
4612/27/2022T
475/27/2021H
488/24/2021E
495/24/2021X
505/8/2023A
516/23/2021M
529/27/2023X
534/28/2023B
541/19/2022J
558/21/2021W
564/18/2021K
572/23/2022W
5810/8/2022P
5912/13/2022A
609/30/2023D
6111/20/2021W
621/10/2023W
637/15/2023N
648/19/2022X
651/29/2023K
663/2/2023P
676/3/2023O
685/17/2023A
694/20/2021E
703/21/2021P
717/28/2021Y
728/23/2022G
739/17/2023I
749/22/2022B
757/9/2021C
7610/19/2022P
775/31/2022R
787/1/2021B
799/28/2023V
807/2/2023V
8110/6/2023Y
8210/5/2021E
836/11/2022X
849/17/2021K
855/21/2023N
865/7/2021E
879/15/2023J
882/12/2022W
895/12/2022M
905/6/2021C
912/14/2022K
9212/3/2021J
935/27/2022L
941/8/2023Q
956/5/2023P
962/20/2022D
973/22/2022K
981/28/2021T
993/23/2023F
1008/29/2021X
1011/15/2022F
1029/2/2022R
1038/18/2023M
1042/24/2022H
1051/10/2022C
1061/29/2021J
10711/5/2022Y
1085/6/2023F
1092/3/2023F
11011/1/2022Q
1112/3/2022D
11210/13/2022J
11312/16/2021N
1147/3/2022U
1154/20/2021Z
1164/22/2023J
1173/9/2022T
1183/5/2022Y
11910/19/2022J
1202/18/2023R
1213/27/2022I
1227/27/2022K
1232/26/2021Y
1244/26/2023O
12511/4/2022C
12610/21/2021X
1279/27/2021X
1282/5/2022W
1296/14/2023U
1307/8/2021Z
13110/7/2022U
13210/11/2021Y
1336/4/2021L
1346/11/2022W
1356/25/2021D
1367/8/2021G
1372/13/2021E
1388/14/2023S
1395/6/2021U
1408/9/2021Z
1413/10/2022B
1427/4/2023V
14311/7/2021A
14412/14/2022D
1455/19/2022N
1463/28/2022F
1474/17/2023H
1488/7/2021O
1493/7/2022A
15012/4/2021K
1518/29/2022T
15210/15/2022A
15311/2/2022A
1549/19/2023D
1551/15/2023I
1564/8/2023V
1572/15/2022R
1581/24/2022S
1596/28/2023K
1603/13/2021N
16110/5/2022Q
16211/15/2022N
1632/4/2022N
1643/26/2023E
16512/20/2022B
1664/22/2023B
1671/11/2022Q
1681/18/2023R
1694/8/2023N
17010/16/2022C
17111/29/2021Q
1724/23/2021R
1738/26/2022O
17411/25/2022P
1752/15/2023Y
17612/26/2021W
1779/20/2022H
17811/7/2021V
17910/11/2021X
1809/9/2022V
1816/10/2023E
1828/11/2023M
1835/6/2022N
1846/14/2023Z
18510/31/2022L
1864/27/2023P
1877/9/2023H
1884/9/2023S
1893/3/2022G
1903/22/2023Q
1914/2/2023B
1925/24/2022C
1938/31/2021K
1941/9/2023W
1958/10/2023Y
1968/20/2022M
1971/15/2022G
1983/18/2022I
1997/31/2021J
20010/7/2022L
201
Sheet2
 
Upvote 0
Solution

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top