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.
I am sure we can help.
It sounds like the Merge is not set up correctly.
Can you show me some sample data and a picture of the Merge screen please?
Hi HotChilli
Thank you for the help
This is the screen I have put the formula in to show current period
And the other table merges on Month End Date but is showing previous still even though the above is showing current
Thanks for your help
- HotChilli5 years agoCommunity Champion
The first thing which is odd is that the datatype on the first Current Period screen is set to 'any', it should be text.
I would like to see the screen from the Merge step - the one where you pick the 2 tables and the join types please.
- Krisso19755 years agoRegular Visitor
I assume you mean this step
- HotChilli5 years agoCommunity Champion
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?