cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
romovaro
Post Patron
Post Patron

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
Helper I
Helper 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
Helper I
Helper 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
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors