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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

Reply
felipescamilo
New Member

How can I see which clients have bought a specific product in only one of last three months?

Hi!

I'm having trouble in figuring out how can i create a measure that gives me which clients have bought a specific product in only one of the last three months.

For an example: If the months in consideration are: january, february and march, I want clients that have bought in jan but not in feb and march, or clients that have bought in feb, but not in jan and mar or even clients that have bought in mar but not in jan and feb.
I know how to do it for a specific month, as in:

 

CALCULATE (
[#Sales],
Product[Product Name] = "XXX",
Period[Month/Year] = "jan/2022"
)

 

Then, i manually create a table where the first column is the clients ID and the second column is the measure above. I wanted a measure that gave me which clients bought the product in only one of the last 3 months.


4 REPLIES 4
FreemanZ
Community Champion
Community Champion

hi @felipescamilo 

try like:

CALCULATE (

[#Sales],

Product[Product Name] = "XXX",

Period[Month/Year] in { "feb/2022", "jan/2022", "mar/2022"}

)

hey @FreemanZ , thanks for your answer. But in this case i would get a list of all clients that bought in those 3 months. What i want are clients that bought in only one of the three months.

hi @felipescamilo 

try like:

CALCULATE (
    [#Sales],
    Product[Product Name] = "XXX",
    (
        Period[Month/Year] = "jan/2022" 
            && Period[Month/Year] <>"feb/2022" 
            &&Period[Month/Year] <>"mar/2022"
    )
    || 
    (
    	Period[Month/Year] = "feb/2022" 
    		&& Period[Month/Year] <>"jan/2022" 
    		&&Period[Month/Year] <>"mar/2022"
    )
    || 
    (
    	Period[Month/Year] = "mar/2022" 
    		&& Period[Month/Year] <>"feb/2022" 
    		&&Period[Month/Year] <>"jan/2022"
    )
)

@FreemanZ the thing is I need to see clients that bought in only one of the last three months. For example: if he bought in jan, I need the number of sales in february and march to be = 0.
I'm thinking about something like this, but easier:

 

IF (
AND (
CALCULATE (
    [#Sales],
    Product[Product Name] = "XXX",
    Period[Month/Year] = "feb/2022" 
    )=0,
CALCULATE (
 [#Sales],
    Product[Product Name] = "XXX",
    Period[Month/Year] = "mar/2022" 
    )=0,
CALCULATE (
[#Sales],
Product[Product Name] = "XXX",
Period[Month/Year] = "jan/2022" 
)
))

 


 

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.