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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

create measure to define new customers with specific criteria

I am new to Power BI, this problem is a little beyond my capability right now, I tried to look for some solutions but nothing really fits what I want.

 

So I have a "order table" like this

 

DateOrder IDCustomer IDProduct IDSales
01.01.2021101A15
01.01.2021202A31
01.01.2021303A59
01.02.2021402A31
01.02.2021503A56
01.02.2021603B13
01.02.2021704B68
01.03.2021803B49
01.03.2021901B45

 

Basically we launched product B in Feb, I would like to know the impact of B on A.

 

So I want to create a measure to find out: for each month, how many existing customers (e.g. 01, 02, 03) who have bought product A in the past, made a purchase on B in the current month. 

 

This means they are not new customers that never bought anything before, like customer 04 in Feb; or existing customers that have bought product B in the past, like customer 03 in Mar. 

 

In addition to COUNTROW, I would also like if it can act as a filter, so if I click on it, another customer visual will show who these customers are, so I can see how much they spent in the past and now on product A.

 

Thanks a bunch in advance!

 

4 REPLIES 4
V-lianl-msft
Community Support
Community Support

Hi @Anonymous ,

 

Try to create a measure and apply it to visual level filter:

Test = 
VAR COUNT_ = CALCULATE(DISTINCTCOUNT('Table'[Product ID]),FILTER(ALLEXCEPT('Table','Table'[Customer ID]),'Table'[Product ID] in {"A","B"}))
RETURN IF(COUNT_>1&&MAX('Table'[Product ID])="B",1,0)

Vlianlmsft_0-1646027517481.png

 

 


Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Thank you this is almost perfect! For product B, they are actually named differently, so I have product B1 and product B2, do you know how  to add it onto your solution? 

tackytechtom
Super User
Super User

Hi @Anonymous ,

 

How about this:

tomfox_0-1645635667504.png

Here is the measure I used:

TomsMeasure = 
VAR _custBoughtProdA = 
SUMMARIZE (
    FILTER ( Table, Table[Product ID] = "A" ),
    Table[Customer ID],
    "Sales", SUM ( Table[Sales] )
)
RETURN
CALCULATE (
    DISTINCTCOUNT( Table[Customer ID] ),
    FILTER ( Table,  Table[Product ID] = "B" ),
    FILTER ( _custBoughtProdA, [Customer ID] = Table[Customer ID] )
)

Let me know if that got you closer a solution!

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/

 



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

Anonymous
Not applicable

Thank you so much for the answer.

 

However with this solution, if a customer has bought product B in previous month, he will be counted again if he bought product B in the current month. 

 

Is it possible to exclude customers who have bought product B in the previous months in your solution?

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.