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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
zombieug
Helper I
Helper I

Calculate Column based on different tables

Hello forum,

I hope you can help me on this one...  Smiley Frustrated

 

I got the following two tables Lifecycle and Parts produced:

LifecycleLifecycle

Parts producedParts produced

I would like to calculate the column Lifecycle (parts produced) in the Lifecycle table.

It should be based on the Action 'Install', Partnumber as well as Line.

 

For the green example:

Partnumber 0804 431 961 was installed on 1st Jan and 10th Jan --> Lifcecycle from 1/1/2018 - 1/10/2018

Partnumber 0804 431 961 belongs to Line 71 --> Parts produced table gives me the information that Line 71 produced a total of 2350 parts during the Lifcycle interval.

 

Is it possible to calculate such a column?

 

If what I am trying to do is not clear to you or your need further information please let me know.

 

 

 

 

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

Hi @zombieug

 

Try this calculated column in LifeCycle

 

LifeCycleProduction =
VAR PreviousInstallDate =
    CALCULATE (
        MAX ( Lifecycle[Date] ),
        FILTER (
            ALLEXCEPT ( Lifecycle, Lifecycle[PartNumber] ),
            Lifecycle[Actions] = "Install"
                && Lifecycle[Date] < EARLIER ( Lifecycle[Date] )
        )
    )
RETURN
    IF (
        Lifecycle[Actions] = "Install"
            && NOT ( ISBLANK ( PreviousInstallDate ) ),
        CALCULATE (
            SUM ( PartsProduced[Partsproduced] ),
            FILTER (
                PartsProduced,
                PartsProduced[Line] = Lifecycle[Line]
                    && PartsProduced[Date] >= PreviousInstallDate
                    && PartsProduced[Date] <= Lifecycle[Date]
            )
        )
    )

View solution in original post

2 REPLIES 2
Zubair_Muhammad
Community Champion
Community Champion

Hi @zombieug

 

Try this calculated column in LifeCycle

 

LifeCycleProduction =
VAR PreviousInstallDate =
    CALCULATE (
        MAX ( Lifecycle[Date] ),
        FILTER (
            ALLEXCEPT ( Lifecycle, Lifecycle[PartNumber] ),
            Lifecycle[Actions] = "Install"
                && Lifecycle[Date] < EARLIER ( Lifecycle[Date] )
        )
    )
RETURN
    IF (
        Lifecycle[Actions] = "Install"
            && NOT ( ISBLANK ( PreviousInstallDate ) ),
        CALCULATE (
            SUM ( PartsProduced[Partsproduced] ),
            FILTER (
                PartsProduced,
                PartsProduced[Line] = Lifecycle[Line]
                    && PartsProduced[Date] >= PreviousInstallDate
                    && PartsProduced[Date] <= Lifecycle[Date]
            )
        )
    )

@Zubair_Muhammad

As always flawless. Thank you sir.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors