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
CRamirez
Advocate II
Advocate II

Filter Customers based on 12 month sales totals

I can't seem to find anything online answering this kind of question which is odd because it seems like a relatively common issue that would occur.

 

I am trying to create a measure that will give me a count of customers that have over $500 in sales over the last 12 months. I have a measure that gives me customer counts and another that will give a customers 12 month sales total. The problem I am getting is that when I try to filter on customers with sales amounts over $500 I am only getting a count of customers with at least a single order over $500 for the past 12 months. This will not account for customers with multiple smaller orders that cumilate to over $500.

 

I am assuming the calculation I am looking for has something to do with SUMX, but it seems to be finicky when it comes to filters.

 

My current database is normalized and has a Customer dimension table with all relevant customer info as well as a Sales fact table. I have a date table as well which is what I use for my time-intelligence measures.

 

Any help would be greatly appreciated

 

 

1 ACCEPTED SOLUTION

Hi @CRamirez,

 

Based on my assumption, table structure looks like below:

1.PNG

 

Please try measures: (In my test, I calculated total sales in last 3 month)

Total Sales last 12 month =
CALCULATE (
    SUM ( 'Sales Fact Table'[Sales] ),
    FILTER (
        ALLEXCEPT ( 'Sales Fact Table', 'Sales Fact Table'[Customer] ),
        'Sales Fact Table'[Date].[MonthNo] < MONTH ( TODAY () )
            && 'Sales Fact Table'[Date].[MonthNo]
                >= MONTH ( TODAY () ) - 3
    )
)


Count customer =
CALCULATE (
    DISTINCTCOUNT ( 'Sales Fact Table'[Customer] ),
    FILTER ( ALL ( 'Sales Fact Table' ), [Total Sales last 12 month] >= 500 )
)

Table visual.

2.PNG

 

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

 

Share the link from where i can download your file.  Also, show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur

 

I'm sorry, but that's not possible. I don't believe downloading my file would be of much use in any case. In addition, I'm not sure what the expected result would be which is why I'm trying to determine this measure.

 

The relevant tables in my dataset is a simple Customer dimension and a Sales Fact table. Is there a way to filter out total customer sales below a certain amount over a 12 month period? For example, a count of customers whose total sales are over $500 over 12 months

Hi @CRamirez,

 

Based on my assumption, table structure looks like below:

1.PNG

 

Please try measures: (In my test, I calculated total sales in last 3 month)

Total Sales last 12 month =
CALCULATE (
    SUM ( 'Sales Fact Table'[Sales] ),
    FILTER (
        ALLEXCEPT ( 'Sales Fact Table', 'Sales Fact Table'[Customer] ),
        'Sales Fact Table'[Date].[MonthNo] < MONTH ( TODAY () )
            && 'Sales Fact Table'[Date].[MonthNo]
                >= MONTH ( TODAY () ) - 3
    )
)


Count customer =
CALCULATE (
    DISTINCTCOUNT ( 'Sales Fact Table'[Customer] ),
    FILTER ( ALL ( 'Sales Fact Table' ), [Total Sales last 12 month] >= 500 )
)

Table visual.

2.PNG

 

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.