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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
romovaro
Responsive Resident
Responsive Resident

Datediff many to many relationships

Hello

 

I want to calculate the diff between 2 dates in diff tables with relationship many to many

 

Both files are the same.

One column is called CUID and is a unique customer number

and GLD is the Go live date of the project.

 

I'm trying this formula but I get an error: A table of multiple values was supplied where a single value was expected.

 

I can have blanks if date is not yet confirmed

 

GLD Diff = DATEDIFF(
    'Planview Daily Extract'[GLD],
    LOOKUPVALUE('Baseline-PV Daily Extract'[GLDate], 'Baseline-PV Daily Extract'[CUID],'Planview Daily Extract'[CUID]),
    MONTH
)

 

 

Any idea?

 

thanks

 

@jgeddes 

1 ACCEPTED SOLUTION
Muhammad110
Advocate I
Advocate I

The error message you're receiving indicates that the lookup value function is returning multiple values where a single value was expected. This can happen if there are multiple records in the 'Baseline-PV Daily Extract' table that match the CUID in the 'Planview Daily Extract' table.

To avoid this error, you can use the maxx function to return the maximum value of the 'GLDate' column for each CUID in the 'Baseline-PV Daily Extract' table. This ensures that only a single value is returned for each CUID.

Here's the updated formula:

 

GLD Diff = DATEDIFF(
'Planview Daily Extract'[GLD],
MAXX(FILTER('Baseline-PV Daily Extract', 'Baseline-PV Daily Extract'[CUID] = EARLIER('Planview Daily Extract'[CUID])), 'Baseline-PV Daily Extract'[GLDate]),
MONTH
)

 

hope this helps 

View solution in original post

2 REPLIES 2
Muhammad110
Advocate I
Advocate I

The error message you're receiving indicates that the lookup value function is returning multiple values where a single value was expected. This can happen if there are multiple records in the 'Baseline-PV Daily Extract' table that match the CUID in the 'Planview Daily Extract' table.

To avoid this error, you can use the maxx function to return the maximum value of the 'GLDate' column for each CUID in the 'Baseline-PV Daily Extract' table. This ensures that only a single value is returned for each CUID.

Here's the updated formula:

 

GLD Diff = DATEDIFF(
'Planview Daily Extract'[GLD],
MAXX(FILTER('Baseline-PV Daily Extract', 'Baseline-PV Daily Extract'[CUID] = EARLIER('Planview Daily Extract'[CUID])), 'Baseline-PV Daily Extract'[GLDate]),
MONTH
)

 

hope this helps 

Thanks for the help. It works.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.