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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
dacosta
Regular Visitor

Reference Another Row for Future Assignment

Hello I need help in creating a column that references another row and populates a future assignment. We assign employees to projects and each assignment comes into the report as a single row. Some employees have a current assignment and future assignment, so they have (2) rows coming into the report. I would like to reference the future assignment row and populate a "Future Assignment Name" column on the row of their current assignment. Would also like to reference the start and end dates of the future assignment row. The reference between rows should be matched by the person name.

 

Sample Data:

Assignment Table

IndexPerson NameAssignment NameAssignment Start DayAssignment End DayCurrent AssignmentNext AssignmentFuture Assignment  Name (need help creating this column)

Future Assignment Start Day

(need help creating this column)

0John DoeProject AlphaNovember 16, 2020March 26, 2021TRUE0Project BetaOctober 4, 2021
1John DoeProject BetaOctober 4, 2021October 28, 2022FALSE1(BLANK)(BLANK)

 

Future Assignment Name =
if(and(
'Assignments'[Next Assignment]=1, 'Assignments'[person_name]=MAX(Assignments[person_name]), var projectname='Assignments'[assignments.project_name])
return(projectname), BLANK())
 
This equation isn't working, I know there is something wrong but I cannot figure it out. Can anyone please help!
1 ACCEPTED SOLUTION

Hi, @dacosta 

You can create the following Calculated columns to get the result you want.

 

Column 1

Rank by Person name =

RANKX (

    FILTER ( ALL ( Assignments ), [person_name] = EARLIER ( [person_name] ) ),

    [Assignment Start Day],

    ,

    ASC,

    DENSE

)

 

Column 2

Future Assignment Name =

CALCULATE (

    MAX ( 'Assignments'[Assignment Name] ),

    FILTER (

        ALL ( Assignments ),

        [Rank by Person name]

            = EARLIER ( [Rank by Person name] ) + 1

            && [person_name] = EARLIER ( [person_name] )

    )

)

 

Column 3

CALCULATE (

    MAX ( 'Assignments'[Assignment Start Day] ),

    FILTER (

        ALL ( Assignments ),

        [Rank by Person name]

            = EARLIER ( [Rank by Person name] ) + 1

            && [person_name] = EARLIER ( [person_name] )

    )

)

 

The result looks like this:

v-cazheng-msft_0-1612938892623.png

 

Here is the sample.

 

Best Regards,

Caiyun Zheng

 

If this post helps, then please consider Accept it as the solutions to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-cazheng-msft
Community Support
Community Support

Hi, @dacosta 

You can create the following Calculated columns to get the result you want.

 

Column 1

Future Assignment Name =

VAR midT1 =

    FILTER (

        ALL ( Assignments ),

        AND (

            Assignments[person_name] <= EARLIER ( Assignments[person_name] ),

            Assignments[Next Assignment] = 1

        )

    )

var midT2=FILTER(midT1,MIN(Assignments[Assignment Start Day]))

VAR val =

    CALCULATE ( SELECTEDVALUE ( Assignments[Assignment Name] ), midT2 )

VAR nam =

    CALCULATE ( SELECTEDVALUE ( Assignments[person_name] ), midT2 )

RETURN

    IF (

        Assignments[person_name] = nam

            && Assignments[Next Assignment] = 0,

        val,

        BLANK ()

    )

 

Column 2

Future Assignment Start Day =

VAR midT1 =

    FILTER (

        ALL ( Assignments ),

        AND (

            Assignments[person_name] <= EARLIER ( Assignments[person_name] ),

            Assignments[Next Assignment] = 1

        )

    )

var midT2=FILTER(midT1,MIN(Assignments[Assignment Start Day]))

VAR val =

    CALCULATE ( SELECTEDVALUE ( Assignments[Assignment Start Day] ), midT2 )

VAR nam =

    CALCULATE ( SELECTEDVALUE ( Assignments[person_name] ), midT2 )

RETURN

    IF (

        Assignments[person_name] = nam

            && Assignments[Next Assignment] = 0,

        val,

        BLANK ()

    )

 

The result looks like this:

v-cazheng-msft_0-1612858293468.png

Here is the sample.

 

Best Regards,

Caiyun Zheng

 

If this post helps, then please consider Accept it as the solutions to help the other members find it more quickly.

 

First off, thank you! This worked for instances where Assignment[person_name] occurs on (2) rows (where a person has 2 assignments). I did have to alter the calculation by removing "<=" and replacing with "=" for the earlier function, after doing this it worked.

 

AND (

            Assignments[person_name] = EARLIER ( Assignments[person_name] ),

            Assignments[Next Assignment] = 1

        )

 

But this column calculation is not working with people that have (3) rows/assignments, a current assignment, a next assignment, and another next assignment. See example below:

 

dacosta_0-1612902004426.png

Hi, @dacosta 

You can create the following Calculated columns to get the result you want.

 

Column 1

Rank by Person name =

RANKX (

    FILTER ( ALL ( Assignments ), [person_name] = EARLIER ( [person_name] ) ),

    [Assignment Start Day],

    ,

    ASC,

    DENSE

)

 

Column 2

Future Assignment Name =

CALCULATE (

    MAX ( 'Assignments'[Assignment Name] ),

    FILTER (

        ALL ( Assignments ),

        [Rank by Person name]

            = EARLIER ( [Rank by Person name] ) + 1

            && [person_name] = EARLIER ( [person_name] )

    )

)

 

Column 3

CALCULATE (

    MAX ( 'Assignments'[Assignment Start Day] ),

    FILTER (

        ALL ( Assignments ),

        [Rank by Person name]

            = EARLIER ( [Rank by Person name] ) + 1

            && [person_name] = EARLIER ( [person_name] )

    )

)

 

The result looks like this:

v-cazheng-msft_0-1612938892623.png

 

Here is the sample.

 

Best Regards,

Caiyun Zheng

 

If this post helps, then please consider Accept it as the solutions to help the other members find it more quickly.

This worked perfectly, thanks for the help.

lbendlin
Super User
Super User

Here's an example based on person and index.

 

Assignment Table:

let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlDSUfLKz8hTcMlPBTIDivKzUpNLFBxzCjISgXy//LLU3KTUIgVDMx0FIwMjkHLfxKLkDAUjiIAhUCAkKNQVSBkoxepEKxliN9AptQRknn9yST7IOBO4ZpiIkQVYyAgo5OboEwwy0FApNhYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Index = _t, #"Person Name" = _t, #"Assignment Name" = _t, #"Assignment Start Day" = _t, #"Assignment End Day" = _t, #"Current Assignment" = _t, #"Next Assignment" = _t])
in
Source

 

Measure  (although this can be debated, I think a calculated column would be appropriate too)

Future Assignment Name =
var i=SELECTEDVALUE('Assignment Table'[Index])
var p=SELECTEDVALUE('Assignment Table'[Person Name])
var fi=MINX(Filter(All('Assignment Table'),'Assignment Table'[Index]>i && 'Assignment Table'[Person Name]=p),'Assignment Table'[Index])
return MINX(Filter(All('Assignment Table'),'Assignment Table'[Index]=fi && 'Assignment Table'[Person Name]=p),'Assignment Table'[Assignment Name])

 

 

lbendlin_0-1612573764201.png

 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.