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
Anonymous
Not applicable

Using lookupvalue within summarize

I have a set of of data that has a list of projects and the dates at which they hit set milestones - I want to be able to understand which milestone is next for each project. I have generated a sample data set below to illustrate. 

 

I believe the code should be close to below, however to add corresponding stage column I am required to do a lookup from a result generated in the summary, which DAX doesn't allow.

 

Summary= ADDCOLUMNS( 
                SUMMARIZE(Table,'Table'[Project]),
                "Next Milestone Date", CALCULATE(MIN('Table'[Event Date], 'Table'[Status]="U")))

 

Status: C = Complete, U = Uncomplete

 

ProjectStageEvent DateStatus
Project A101/09/2018C
Project A201/11/2018C
Project A301/05/2019U
Project A401/08/2019U
Project A501/01/2020U
Project A601/05/2020U
Project B101/01/2019C
Project B201/02/2019U
Project B301/08/2019U
Project B401/01/2020U
Project B501/02/2020U
Project B601/07/2020U
Project C101/10/2018C
Project C201/12/2018C
Project C301/01/2019C
Project C401/02/2019U
Project C501/05/2019U
Project C601/07/2019U

 

ProjectNext EventNext Stage
Project A01/05/20193
Project B01/02/20192
Project C01/02/20194

 

 

1 ACCEPTED SOLUTION

Works fine on my end. Check the file out 

View solution in original post

3 REPLIES 3
AlB
Super User
Super User

Hi @Anonymous 

 

Try this:

 

Summary =
ADDCOLUMNS (
    ADDCOLUMNS (
        SUMMARIZE ( 'Table'; 'Table'[Project] );
        "Next Milestone Date"; CALCULATE ( MIN ( 'Table'[Event Date] ); 'Table'[Status] = "U" )
    );
    "Next Stage"; LOOKUPVALUE (
        'Table'[Stage];
        'Table'[Event Date]; [Next Milestone Date];
        'Table'[Project]; [Project]
    )
)
Anonymous
Not applicable

@AlB Thanks for the response.

 

Although I agree/understand the logic. Your solution generates the error, "a table of multiple values was supplier where a single value was expected'

 

 

Works fine on my end. Check the file out 

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.