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

Identify Months of activity per customer

Trying to think how best to go about a measure my boss has asked for.

 

He wants data on "active" accounts, meaning by customer how many months have the traded.

 

E.g. Customer ABC Ltd, traded in Jan, Feb, March - so 3 months of trade

Customer 123 PLC, traded Jan, March, April, Nov, Dec - so 5 months of trade

 

For this to be relative, I think it will need to be based on the prior 12 months rolling rather than a calendar year.

 

I could quite easily visualize this, but the aim is more to identify customers by "activity" (i.e. months traded), then put them in buckets 0-3 Low, 4-6 Medium, 7-12 High (based on last 12 moths)

 

My data is on an invoice table like this (each row is the invoice date)

 

CustomerPartInvoice Date  
ABC LTDXXXXXX01/01/2022  
ABC LTDYYYYYY20/02/2022  
ABC LTDLLLLLL03/03/2022  
123 PLCXXXXXX21/01/2022  
123 PLCXXXXXX03/03/2022  
123 PLCYYYYYY14/04/2022  
123 PLCYYYYYY10/11/2022  
123 PLCYYYYYY25/12/2022  
2 REPLIES 2

Thanks for this. 

It functions, but it doesnt quite do what I wanted it to (my fault for not being clear).

I dont want the count of activity on each month, rather I want to know if a month has had any activity at all (i.e. an active month, if its 1 or 1000 transactiosn), then the how many months have been active.

Example, results I want to see is for Jan there was activity, sames for Feb, so 1 for Jan, 1 for Feb, means 2 months of activity (in the last 12 months). 

example.JPG

v-rzhou-msft
Community Support
Community Support

Hi @mattrixdesign2 ,

 

I suggest you to create a Calendar table to help Calculation.

Calendar = 
ADDCOLUMNS (
    CALENDAR ( DATE ( 2022, 01, 01 ), DATE ( 2023, 12, 31 ) ),
    "Year", YEAR ( [Date] ),
    "Month", FORMAT ( [Date], "MMMM" ),
    "MonthSort", MONTH ( [Date] )
)

Measure:

Buckets = 
VAR _RANGEEND =
    MAX ( 'Calendar'[Date] )
VAR _RANGESTART =
    EOMONTH ( _RANGEEND, -12 ) + 1
VAR _Filter12Period =
    FILTER (
        'Table',
        'Table'[Invoice Date] >= _RANGESTART
            && 'Table'[Invoice Date] <= _RANGEEND
    )
VAR _Count =
    COUNTAX ( _Filter12Period, [Invoice Date] )
RETURN
    SWITCH (
        TRUE (),
        _Count <= 3, "0-3 Low",
        _Count <= 6, "4-6 Medium",
        _Count <= 12, "7-12 High"
    )

Result is as below.

vrzhoumsft_0-1698981862137.png

vrzhoumsft_1-1698981870585.png

 

Best Regards,
Rico Zhou

 

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.