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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
tdanielspbi
Frequent Visitor

Calculated Column to Calculate Date Per ID When Cumulative Sales Exceeds Target in Power BI

Hello Power BI Community,

 

I'm working on a project where I need to create a calculated column that calculates the date per ID when the cumulative sales have exceeded their respective target. I have two tables, Table 1 (budgets per ID) and the Sales Table (sales transactions). There is a one-to-many relationship between these tables.

 

Here's a sample of the data I'm working with:

Table 1 (Budgets per ID):

ID Target

11000
21500
32000

 

Sales Table (Sales Transactions):

ID Date Sales

12023-01-01300
12023-01-02400
12023-01-03350
22023-01-01500
22023-01-02600
22023-01-03450
32023-01-01800
32023-01-02700
32023-01-03600

 

I need a calculated column in Table 1 to show the date when the cumulative sales per ID have exceeded the target.

 

Any suggestions on how to create this calculated column in Power BI?

 

Thank you in advance for your help!

1 REPLY 1
FreemanZ
Super User
Super User

hi @tdanielspbi 

try to add a calculated column like:

 

Date = 
MINX(
    FILTER(
        RELATEDTABLE(Sales),
        VAR _date = Sales[Date]
        RETURN
            CALCULATE(
                SUM(Sales[Sales]),
                Sales[Date]<=_date,
                ALLEXCEPT(Sales,Sales[ID])
            )>=[Target]
    ),
    Sales[Date]
)

 

i slightly changed your Table1[Target] column to better verify the code. it worked like:

FreemanZ_0-1682171795559.png

 

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.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.