Forum Discussion
Merge not pulling through correct information
- 5 years ago
Hi, Krisso1975
Based on your description, I assume that you want to create a custom column based on date column. I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
You may create a custom column with the following m codes.
let start = Date.AddDays( Date.EndOfMonth( Date.AddMonths([Date],-1)),1), end = Date.EndOfMonth([Date]), today = Date.From(DateTime.LocalNow()) in if today<start then "Next" else if today>end then "Previous" else if today>=start and today<=end then "Current" else nullResult:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
That's the screen.
I see that the tables join on PeriodEndDate and MonthEndDate and so we're looking for a MonthEndDate of 30/04/2021 in the splitBills table (if I've got that right) to bring back "Current".
Do we have that?
I thought (wrongly) im guessing the merge step would acheive that on the above. You are correct on the return in the split bills table
To give you more context at what I am trying to acheive this is a screen grab of my excel version
So far I have easily created the annual and monthly targets and have pulled through accurate data for the years billing. I am now trying to acheive the current month data and then try and do the other calculations. If that makes sense
- HotChilli5 years agoCommunity Champion
I can't really get in to the details of the end solution.
Do you want to carry on investigating the merge problem? I was asking if there is a record with MonthEndDate of 30/04/2021 in the splitBills table. If there is, have a look in the merged table to see what's happened to it.
If you want to post the 2 tables on a 3rd party site and the pbix, I'll take a look. Send the link thru this site message service if you don't want to post a public link.
- Krisso19755 years agoRegular Visitor
The month end date of 30/04/2021 wont exist until next month when the Periods details table adds 12 new periods.
Would this be part of my issue though.
I cant really load the tables to anywhere as the contain client data and would breach our GDPR policy sadly
- HotChilli5 years agoCommunity Champion
So that would explain it. The field doesn't come through in the merged table because there is no matching field in the splitBills table. Does that make sense?