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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Trying to get days elapsed on columns from two different tables

I'm at a loss how to make this work. Essentailly i'm working with transactions of components and trying to work out days elapsed between the two transactions (Removal, repair order created).

The original data is a row by row of transaction type that also has a transaction date. Each component has a batch number which is included in the data so to simplify things I split the original table into two seperate tables and use the batch number as a relationship between them. Below is a summarised version of the data.
Removal Table

TransactionBatchRemoval Date
Removal11, January 2021
Removal2

2, January 2021

Removal3

4, January 2021

 

RO create Table

TransactionBatchOrder numberCreated Date
RO Create1A3, January 2021
RO Create2B5, January 2021
RO Create 3C9, January 2021


In order to work this out i thought i could do a LOOKUPVALUE to bring the Created Date into the Removals Table and then use DATEDIFF to work out the days elapsed.

I tried using this DAX formula for the new column RO Date = LOOKUPVALUE(RO[Created Date], RO[Batch], Removal[Batch])

But I get the error message "A table of multiple values was supplied where a single value was expected." I've tried switching the two batch columns around and get the same issue. I've looked for a solve and found a few similar issues but none of the solutions offered work for me.

Greatly appreciate any assistance here.

5 REPLIES 5
wdx223_Daniel
Super User
Super User

what kind of the relationship between these tables?

which one is on the one side?

 

Anonymous
Not applicable

It's many to many. It won't let me change to many to one. It says "The cardinality you've selected isn't valid for this relationship".

try this

RO Create Date=minx(filter(CreateTable,CreateTable[Batch ID]=RemovalTable[Batch ID]),CreatTable[Create Date])

Anonymous
Not applicable

Any tips on where i can go from here? I'm still completely lost on this one and my boss is getting impatient waiting on the report. I mean i can do this in excel with Vlookup so surely it should work in power bi, and i'd rather do it in power bi so i don't have to re-do the vlookup every week when i update the data.

Appreciate the help!

Anonymous
Not applicable

That is only producing one date in every row of the column, I'm guessing that's the Minx function which is finding the earliest date from the created date column. I probably should have specified the tables have hundreds of lines with different batches and dates respectively.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.