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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
domtrump
Helper II
Helper II

Activity before and after a date

I have customer records in a table with all sales activity. For each customer, there is a single trigger date for a particular event (when they became a loyalty member). Every customer's trigger date will be different. I'm looking for a pattern that will summarize the patrons sales data for the six months prior to the trigger date (and then I'll use the same pattern to get the six months after for comparison). How do I go about this?

1 REPLY 1
FreemanZ
Super User
Super User

hi @domtrump 

try like:

Diff = 
VAR _triggerdate =
VAR _currentdate = MAX(TableName[Date])
VAR _salespre =
CALCULATE(
    SUM(TableName[Sales]),
    TableName[Date] >= EDATE(_currentdate, -6),
    TableName[Date] <= _currentdate
)
VAR _salesafter =
CALCULATE(
    SUM(TableName[Sales]),
    TableName[Date] <= EDATE(_currentdate, 6),
    TableName[Date] >= _currentdate
)
RETURN
_salesafter - _salespre

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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