Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi all,
I'm trying to build a table with DAX with the crossjoin function but I need it to follow certain conditions. I have a table with information about several different opportunities, which have information about the amount, stage, probability, close date, etc. This table records all of these information everytime an update is made to that opportunity and it looks like the table below (for simplification I'm only including amount values):
OpportunityID | CreatedDate | CurrentDate | Amount |
006D000000yMreEIAS | 19/01/2018 | 28/08/2018 | 120000 |
006D000000yMreEIAS | 27/06/2018 | 28/08/2018 | 200000 |
006D000000yMreEIAS | 04/08/2018 | 28/08/2018 | 600000 |
006D000000yMreEIAS | 05/08/2018 | 28/08/2018 | 800000 |
What I want to do is for each opportunity (given by the OpportunityID) I want to create rows that display the value of the opportunity in each month since its creation until the current date. If there are multiple amount alterations in the same month, I would like to get the last value for that month. In this example, it would be like this (notice that this sample contains only data for a single opportunity and it tracks the several updates there was to the opportunity) :
OpportunityID | CreatedDate | CurrentDate | Amount |
006D000000yMreEIAS | 19/01/2018 | 28/08/2018 | 120000 |
006D000000yMreEIAS | 28/02/2018 | 28/08/2018 | 120000 |
006D000000yMreEIAS | 31/03/2018 | 28/08/2018 | 120000 |
006D000000yMreEIAS | 30/04/2018 | 28/08/2018 | 120000 |
006D000000yMreEIAS | 31/05/2018 | 28/08/2018 | 120000 |
006D000000yMreEIAS | 27/06/2018 | 28/08/2018 | 200000 |
006D000000yMreEIAS | 31/07/2018 | 28/08/2018 | 200000 |
006D000000yMreEIAS | 05/08/2018 | 28/08/2018 | 800000 |
I have done a cross join between my Opportunity table and my Calendar table with the following conditions:
CrossJoin = FILTER(CROSSJOIN('Opportunity', 'Calendar'), 'Calendar'[Date] >= 'Opportunity'[CreatedDate] && 'Calendar'[Date] <= 'Opportunity '[CurrentDate])
But this is creating entries for each row from created to current date and not by OpportunityID, as I want. I would need a formula that would recognize the next created date within the same opportunity and would add rows until that date. Plus, I don't mind it having creating rows for all days in the month, I can just select the latest one later on. It is only important to know what the value was for each month since the creation until the end/current date of the opportunity. Any ideas?
Best regards,
Antonio
Solved! Go to Solution.
Hi @antoniopgouveia,
Based on my test, you could try to use this formula:
CrossJoin= CROSSJOIN('Opportunity', CALCULATETABLE('Calendar',FILTER('Calendar','Calendar'[Date] >= MIN('Opportunity'[CreatedDate]) && 'Calendar'[Date] <= MIN('Opportunity'[CurrentDate]))))
Regards,
Daniel He
Hi @antoniopgouveia,
Could you please tell me if your problem has been solved? If it is, could you please mark the helpful replies as Answered?
Regards,
Daniel He
Hi @antoniopgouveia,
Based on my test, you could try to use this formula:
CrossJoin= CROSSJOIN('Opportunity', CALCULATETABLE('Calendar',FILTER('Calendar','Calendar'[Date] >= MIN('Opportunity'[CreatedDate]) && 'Calendar'[Date] <= MIN('Opportunity'[CurrentDate]))))
Regards,
Daniel He
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.