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

Filling a field from another field in a table

I am trying to fill a field with data from another table - however when I do this using Table[Field] in Custom Column my file goes into meltdown and turns from a 500kb file to one of many many Mb - so must be doing something wrong.

 

So I have a table of invoices which show the Date Due and the period in which the invoice was raised. The data table is an historical data snapshot - so each period I get new data. But rather than hard-coding when the data relates to I want to use a query to work it out. (also need to learn how to post nice data!)

 

Below is a very brief extract of the tables - this is the  main data table

Period     Customer    Due Date    Amount     Calc    Days  Over

202102Abcde02/01/20221000  
202101Abcde01/01/2021500  
202003Abcde03/01/2022500  

 

I then have a table which will give me the effective due date based on the Period

 

Period     Abs Due Date

20210231/05/2021
20210130/04/2021
20201231/03/2021

 

So Looking at my main data table I can see that the most recent period for which I have data is 202102 - so that tells me I need to use 31/05/2021 as my Calc date - I get this by duplicating my data table, stripping out all columns except for period, remove duplicates, sort by Period and remove all but the first entry - so I get the following table

 

Period
202102

 

What I was doing was then adding this field to my main data table (for all rows) using a custom column and then trying to use a Merge to bring in the Abs Due Date into the Table so I can then calculate exactly how many days over each invoice is by subdtracting the Abs Due Date form the Due Date

 

But when I do this my Query goes into a melt down - takes for ever to evaluate and grows into many many MB!

 

I think what I am doing is quite simple - but clearly I am going about it wrong - still a relative newbie!!

4 REPLIES 4
Calvinorr
Frequent Visitor

Thanks - I will give both a go and see what it does to the memory and size of the file

Hi @Calvinorr 

Does my solution work? Can you share some feedback? 

v-jingzhang
Community Support
Community Support

Hi @Calvinorr 

 

I'm not sure if I understand your expected outcome correctly, so I will provide two solutions below based on two scenarios. I think the latter one is probably what you want. 

 

Scenario One: 

If you want to bring Abs Due Date from Effective Due Dates table into Main data table based on every period, you can use Merge Queries feature. Steps are as below. 

vjingzhang_0-1649226026768.png

vjingzhang_1-1649226122925.png

vjingzhang_2-1649226170118.png

 

Finally add a custom column to calculate over days. 

 

Duration.Days([Due Date] - [Abs Due Date])

 

vjingzhang_3-1649226410475.png

 

Scenario Two:

When you want to get the latest Abs Due Date value for all rows in Main data table.

In Effective Due Data table, sort by Period column descendingly, then keep the top one row. You will get the latest row.

vjingzhang_0-1649227480103.png

 

In Main data table, add a custom column with below code. 

List.First(Table.Column(#"Effective Due Dates (2)","Abs Due Date"))

vjingzhang_1-1649227652913.png

 

Finally add a custom column to get over days with the same method in Scenario One. 

vjingzhang_2-1649227830578.png

 

Both samples are included in the attached pbix file. Hope it helps!

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

watkinnc
Super User
Super User

Seems like you could just use Table.NestedJoin (PriorStepOrTableName, {Period}, OtherTableName, {Period}, "TableValues", JoinKind.LeftOuter)

 

--Nate

 


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!

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.

Top Solution Authors
Top Kudoed Authors