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
akov
Frequent Visitor

Measure with Lookupvalue?

Hello,

 

I am trying to create a formula that uses a lookupvalue function within a measure (Which might not be the best way to solve my problem). What I am trying to do is create a measure that finds the maximum Valid_From_Dttm prior to 5/1/2108 for a specific project, where Project_Milestone_Name = Project Mature. Based upon that resulting value/row, I then want my measure to lookup the corresponding "Report Date". Below is an image of the table I am working with and the Dax formulas I have written so far. It seem like it should be working using a measure and then a column based upon the measure, but the column that is based upon the measure returns a circular dependency error (Which makes sense since I'm not telling it what to calculate first). 

 

BI Snip.PNG

Measure:

Max Mature Valid From Date = CALCULATE(MAXX('SUV Project_Critical_Milestone_Progression','SUV Project_Critical_Milestone_Progression'[Valid_From_Dttm]),'SUV Project_Critical_Milestone_Progression'[Project_Milestone_Name] = "Project Mature", 'SUV Project_Critical_Milestone_Progression'[Valid_From_Dttm] < DATE(2018,05,01))

 

Column:

Mature Report Date = LOOKUPVALUE('SUV Project_Critical_Milestone_Progression'[Report Date], 'SUV Project_Critical_Milestone_Progression'[Valid_From_Dttm],[Max Mature Valid From Date])

 

Here is the error message that I get back for the column: 

A circular dependency was detected: SUV Project_Critical_Milestone_Progression[Column], 126c400b-8ac4-4010-9adb-0ad3590f4118, SUV Project_Critical_Milestone_Progression[Column]. 

 

Thanks in advance for any help and please let me know if my question is not clear. 

 

-Alex

 

1 ACCEPTED SOLUTION
v-chuncz-msft
Community Support
Community Support

@akov,

 

You may take a look at the following post.

https://community.powerbi.com/t5/Desktop/Find-last-value-based-on-date/m-p/293150#M129228

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-chuncz-msft
Community Support
Community Support

@akov,

 

You may take a look at the following post.

https://community.powerbi.com/t5/Desktop/Find-last-value-based-on-date/m-p/293150#M129228

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Sam,

 

Thank you for the response, that post solved my problem!

 

I created a measure using the following:

 

Mature Date Prior to May 1 2018 = MAXX(TOPN(1, FILTER('SUV Project_Critical_Milestone_Progression', 'SUV Project_Critical_Milestone_Progression'[Project_Milestone_Name] ="Project Mature" && 'SUV Project_Critical_Milestone_Progression'[Valid_From_Dttm] < DATE(2018,05,10)), 'SUV Project_Critical_Milestone_Progression'[Valid_From_Dttm],DESC), 'SUV Project_Critical_Milestone_Progression'[Report Date])

Anonymous
Not applicable

@akov Can you post an excel sheet with dummy data for this problem? Also why are you not creating the 2nd column as a measure.

 

In the mean time try using an if statement comparing max date with from date and give the report date as output if true. 

IF(MaxDate = FromDate,ReportDate,NULL)

@Anonymous

 

Thank you for your response! Please see the dummy data below (I can't figure out how to attach a file). Table one contains the Data with the dates and milestones and table two contains the Single Project Name and Project _SK. Table one is joined in the model, many to one, to table two. 

 

To be clear, what I am trying to do is create a report that shows the project name and then the Report date for the "Project Mature" milestone that has the Max Date prior to May 1, 2018. 

 

Something likes this

 

Project Name     Project Mature Date (Prior to May 1 2018)

Project 1          Null

Project 2          Null

Project 4          2/28/2019

Project 6          5/31/2010

 

I tried the formula you provided below, but it gave me the same error about a circular dependency. 

 

 

Table 1

Project_NameProject_SKProject_Milestone_NameEstimated_DateActual_DateprogressionValid_From_DttmValid_To_DttmReport Date
Project 1264Material Permits Non-Appealable  NA6/21/2018 13:22  
Project 1264Project Mature  NA6/21/2018 13:22  
Project 1264Site Secured  NA6/21/2018 13:22  
Project 2191Material Permits Non-Appealable  NA4/24/2018 17:06  
Project 2191Project Mature  NA4/24/2018 17:06  
Project 2191Site Secured  NA4/24/2018 17:06  
Project 3200Material Permits Non-Appealable  NA4/24/2018 17:06  
Project 3200Project Mature  NA4/24/2018 17:06  
Project 3200Site Secured  NA4/24/2018 17:06  
Project 457Material Permits Non-Appealable10/24/2018 0:00 Not Started4/24/2018 17:064/30/2018 16:0810/24/2018 0:00
Project 457Material Permits Non-Appealable10/23/2018 0:00 Not Started4/30/2018 16:085/7/2018 10:3810/23/2018 0:00
Project 457Material Permits Non-Appealable10/24/2018 0:00 Not Started5/7/2018 10:386/22/2018 13:4210/24/2018 0:00
Project 457Material Permits Non-Appealable3/1/2019 1:00 Not Started6/22/2018 13:42 3/1/2019 1:00
Project 457Project Mature3/1/2019 0:00 In Progress4/24/2018 17:064/30/2018 16:083/1/2019 0:00
Project 457Project Mature2/28/2019 0:00 In Progress4/30/2018 16:085/7/2018 10:382/28/2019 0:00
Project 457Project Mature3/1/2019 0:00 In Progress5/7/2018 10:38 3/1/2019 0:00
Project 457Site Secured9/15/2017 0:00 In Progress4/24/2018 17:064/30/2018 16:089/15/2017 0:00
Project 457Site Secured9/14/2017 0:00 In Progress4/30/2018 16:085/7/2018 10:389/14/2017 0:00
Project 457Site Secured9/15/2017 0:00 In Progress5/7/2018 10:385/23/2018 0:059/15/2017 0:00
Project 457Site Secured7/1/2018 0:00 In Progress5/23/2018 0:05 7/1/2018 0:00
Project 547Material Permits Non-Appealable  NA4/24/2018 17:06  
Project 547Project Mature  NA4/24/2018 17:06  
Project 547Site Secured  NA4/24/2018 17:06  
Project 662Material Permits Non-Appealable6/4/2019 0:00 Not Started4/24/2018 17:064/30/2018 16:086/4/2019 0:00
Project 662Material Permits Non-Appealable6/3/2019 0:00 Not Started4/30/2018 16:085/7/2018 10:386/3/2019 0:00
Project 662Material Permits Non-Appealable6/4/2019 0:00 Not Started5/7/2018 10:38 6/4/2019 0:00
Project 662Project Mature6/1/2020 0:00 Not Started4/24/2018 17:064/30/2018 16:086/1/2020 0:00
Project 662Project Mature5/31/2020 0:00 Not Started4/30/2018 16:085/7/2018 10:385/31/2020 0:00
Project 662Project Mature6/1/2020 0:00 Not Started5/7/2018 10:38 6/1/2020 0:00
Project 662Site Secured12/28/2018 0:00 In Progress4/24/2018 17:064/30/2018 16:0812/28/2018 0:00
Project 662Site Secured12/27/2018 0:00 In Progress4/30/2018 16:085/7/2018 10:3812/27/2018 0:00
Project 662Site Secured12/28/2018 0:00 In Progress5/7/2018 10:38 12/28/2018 0:00
Project 7175Material Permits Non-Appealable  NA4/24/2018 17:06  
Project 7175Project Mature  NA4/24/2018 17:06  
Project 7175Site Secured  NA4/24/2018 17:06  
Project 865Material Permits Non-Appealable2/1/2019 0:00 In Progress6/15/2018 13:02 2/1/2019 0:00
Project 865Material Permits Non-Appealable2/1/2019 0:00 Not Started4/24/2018 17:064/30/2018 16:082/1/2019 0:00
Project 865Material Permits Non-Appealable1/31/2019 0:00 Not Started4/30/2018 16:085/7/2018 10:381/31/2019 0:00
Project 865Material Permits Non-Appealable2/1/2019 0:00 Not Started5/7/2018 10:386/15/2018 13:022/1/2019 0:00
Project 865Project Mature1/30/2019 0:00 In Progress4/24/2018 17:064/30/2018 16:081/30/2019 0:00
Project 865Project Mature1/29/2019 0:00 In Progress4/30/2018 16:085/7/2018 10:381/29/2019 0:00
Project 865Project Mature1/30/2019 0:00 In Progress5/7/2018 10:38 1/30/2019 0:00
Project 865Site Secured4/10/2018 0:00 Complete6/15/2018 13:026/19/2018 17:424/10/2018 0:00
Project 865Site Secured3/2/2018 1:005/15/2018 6:00Complete6/19/2018 17:42 5/15/2018 6:00
Project 865Site Secured4/10/2018 0:00 In Progress4/24/2018 17:064/30/2018 16:084/10/2018 0:00
Project 865Site Secured4/9/2018 0:00 In Progress4/30/2018 16:085/7/2018 10:384/9/2018 0:00
Project 865Site Secured4/10/2018 0:00 In Progress5/7/2018 10:386/15/2018 13:024/10/2018 0:00

 

Table 2

 

Project NameProject_SK
Project 1264
Project 2191
Project 3200
Project 457
Project 547
Project 662
Project 7175
Project 865

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.