cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
antoniopgouveia
Frequent Visitor

Crossjoin table from start to finish date by ID

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):

 

OpportunityIDCreatedDateCurrentDateAmount
006D000000yMreEIAS19/01/201828/08/2018120000
006D000000yMreEIAS27/06/201828/08/2018200000
006D000000yMreEIAS04/08/201828/08/2018600000
006D000000yMreEIAS05/08/201828/08/2018800000

 

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) :

 

OpportunityIDCreatedDateCurrentDateAmount
006D000000yMreEIAS19/01/201828/08/2018120000
006D000000yMreEIAS28/02/201828/08/2018120000
006D000000yMreEIAS31/03/201828/08/2018120000
006D000000yMreEIAS30/04/201828/08/2018120000
006D000000yMreEIAS31/05/201828/08/2018120000
006D000000yMreEIAS27/06/201828/08/2018200000
006D000000yMreEIAS31/07/201828/08/2018200000
006D000000yMreEIAS05/08/201828/08/2018800000

 

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

1 ACCEPTED SOLUTION

Accepted Solutions
Microsoft v-danhe-msft
Microsoft

Re: Crossjoin table from start to finish date by ID

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

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Microsoft v-danhe-msft
Microsoft

Re: Crossjoin table from start to finish date by ID

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

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Microsoft v-danhe-msft
Microsoft

Re: Crossjoin table from start to finish date by ID

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

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Join THE global Microsoft Power Platform event series.

Join THE global Power Platform event series.

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors