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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
SammyNed
Helper I
Helper I

Summarize by 2 columns

Hi guys,

 

Need some assistance please.

This is long winded, but I have the following table, simplified below. Basically customer ID's, date of order and order category. I want to know how many cummulative 'Loyal" customers per month and what category the LOYALS are buying from per month. a 'Loyal" customer is someone who has ordered more than once.

 

 

SammyNed_0-1634584638708.png

I want to know how many loyal customers i accumulate per month as well as which category they are ordering from. 

 

So in March we should only have 1 loyal customer (customer A with 3 orders).

In April we should have 2 loyal customers (customer A with a total of 4 orders and customer C with a total of 3 orders). This ties in with the first graph and DAX measure below

 

Then secondly of those that are loyal, i want to know how many orders they place per category per month, as per the second graph. 

So in Mar, A ( who is loyal now) spent 1 order in 3 categorys.

In April, A (loyal for life) ordered in 1 category and C (who is now Loyal) ordered from 2 different categorys.

SammyNed_2-1634585019696.pngSammyNed_1-1634584923393.png

 

I have the following thus far to make the first graph, but can't seem to incorporate the category type to get the second graph as it then starts calculating the loyal customers PER category which isn't correct.

 

Loyal Customers Count =

var _month =
MAX(Date[Date])
 
var _untilcurrentmonthyeartable =
FILTER(ALL(Sales),Date<= _month)

var _customercounttable =
GROUPBY( _untilcurrentmonthyeartable, ID, "@customercount", SUMX(CURRENTGROUP(),1))
 
var _loyalcustomerstable =
FILTER(_customercounttable,[@customercount]>=2)
 
Return
COUNTROWS(_loyalcustomerstable)
 
Please help.
 
Thanks in advance
SammyNed

 

 

2 REPLIES 2
amitchandak
Super User
Super User

@SammyNed , You can use date and month year from date table, if you are using that in visual 

 

Try measure like

 

countx(filter(summarize(Table, Table[Customer],"_1", calculate(distinctcount(Table[Date]))),[_1] >1),[Customer])

 

or

 

 

countx(filter(summarize(Table, Table[Customer], Table[Month Year],"_1", calculate(distinctcount(Table[Date]))),[_1] >1),[Customer])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak 

 

Thank you for your reply, but i don't see how your solution can give me the second graph which needs to include the categorys purchased? Am i missing something?

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.