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
JeromeTEL
Frequent Visitor

how much did customer spend in the last 12 months

I want to know how much a customer have spend in the last 12 months locally.
 
In my matrix table, I added a customer ID Column and the below measure
 
ID12M Spend Local 
2311A$2,178
 
This is not what I want because instead of looking at 365 days prior to his last purchase, I need to know how much he spent over the last 365 days ending today / a specific date.
 
In this case the customer did not purchase in the last 12 months, hence the result should be

 

ID12M Spend Local 
2311A$0
 
Thank you in advance.
 
12M Spend Local =
CALCULATE(SUM(Transactions[Sales USD excl. Tax]),
  DATESBETWEEN(Transactions[Transaction Date],
    MAX(Transactions[Transaction Date]) - 365,
    MAX(Transactions[Transaction Date])),
  Transactions[LOCALS] = True)
1 REPLY 1
johnt75
Super User
Super User

Change the MAX( Transactions[Transaction Date] ) to TODAY().

12M Spend Local =
CALCULATE(SUM(Transactions[Sales USD excl. Tax]),
  DATESBETWEEN(Transactions[Transaction Date],
    TODAY()365,
    TODAY() ),
  Transactions[LOCALS] = True)

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.

Top Solution Authors