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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Show customers based on historical sales

Hi all! 

 

I need to filter my customer data. I have sales data for a couple of months. But I only want to see data for customers that purchased in month 1. 

 

So if the customer purchased something in month 1, I want to se all his purchases. If the customer did not purchase in month 1 i do not want to include the customer. In the below example I do not want to include date for customer 3. 

 

Merknad 2021-08-05 144032.jpg

 

Any suggestions on how I can achieve this? All help is highly appreciated!!! 

 

Christer

 

1 ACCEPTED SOLUTION
v-xulin-mstf
Community Support
Community Support

Hi @Anonymous,

 

Try meausre as:

Measure = 
var _isblank=
SUMX(
    FILTER(
        ALL(Table1),
        Table1[Customer]=MAX(Table1[Customer])
    ),
    IF(
        ISBLANK(Table1[Sales]),
        1,
        0
    )
)
var _sum=
SUMX(
    FILTER(
        ALL(Table1),
        Table1[Customer]=MAX(Table1[Customer]) && MONTH(Table1[Date])>=9 && MONTH(Table1[Date])<=11
        ),
        Table1[Sales])
return
IF(
    _isblank=0 && _sum>7500,
    1,
    0
 )

Here is the output:

vxulinmstf_0-1628581846716.png

The pbix is attached, please try it.

If you still have some question, please don't hesitate to let me known.‌‌

 

Best Regards,

Link

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!

 

View solution in original post

3 REPLIES 3
v-xulin-mstf
Community Support
Community Support

Hi @Anonymous,

 

Try meausre as:

Measure = 
var _isblank=
SUMX(
    FILTER(
        ALL(Table1),
        Table1[Customer]=MAX(Table1[Customer])
    ),
    IF(
        ISBLANK(Table1[Sales]),
        1,
        0
    )
)
var _sum=
SUMX(
    FILTER(
        ALL(Table1),
        Table1[Customer]=MAX(Table1[Customer]) && MONTH(Table1[Date])>=9 && MONTH(Table1[Date])<=11
        ),
        Table1[Sales])
return
IF(
    _isblank=0 && _sum>7500,
    1,
    0
 )

Here is the output:

vxulinmstf_0-1628581846716.png

The pbix is attached, please try it.

If you still have some question, please don't hesitate to let me known.‌‌

 

Best Regards,

Link

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!

 

amitchandak
Super User
Super User

@Anonymous , based on data I see, Try a measure like

measure  =

var _tab = except(distinct(Table[customer]), filter(distinct(Table[customer]), isblank([sales date])))

return

calculate(sum(Table[sales]) , filter( Table, Table[Customer] in _tab))

Anonymous
Not applicable

Hi @amitchandak 

 

Thank you for your reply. I think I oversimplified the task a bit. 

 

I have sales data for a couple of months. I have a criteria for a further analysis I need to apply to the customer selection. 

 

If sales were above 7500 in september, october or november I want to include the customer. However, if there are no sales in any of these months, but sales above 7500 in later months, I do not want to include this customer. 

 

Merknad 2021-08-05 154959.jpg

 

So in this example, I do not want to include the above customers at all, but i do want to include the bottom two customers. 

 

Christer

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.