Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
nseward
Regular Visitor

For each opportunity generate rows of dates

I currently have a table of opportunities with start/end dates and estimated revenue. 

 

I'm trying to generate a series of revenues for it while still retaining the ability to filter by opportunity. 

 

Input Table #1

OpportunityStart DateEnd DateEstimated RevenueMonthly Revenue
A3/1/20249/1/2024$100,000$16,667
B4/1/20247/1/2024$125,000$41,667

 

Input Table #2

Dates
4/1/2024
5/1/2024
6/1/2024
7/1/2024
8/1/2024
9/1/2024

 

Desired Output Table

OpportunityDateRevenue
A4/1/2024$16,667
A5/1/2024$16,667
A6/1/2024$16,667
A7/1/2024$16,667
A8/1/2024$16,667
A9/1/2024$16,667
B5/1/2024$41,667
B6/1/2024$41,667
B7/1/2024$41,667
1 ACCEPTED SOLUTION
Daniel29195
Super User
Super User

@nseward 

output

Daniel29195_0-1708558871670.png

 

 

caluclated table : 

Table 2 = 



var ds = 
ALLNOBLANKROW(tbl1)

var ds1 = 
SELECTCOLUMNS(
GENERATE(
    ds,
    var v1 = tbl1[Start Date]
    var v2 = tbl1[End Date]
    RETURN
    CALENDAR(v1,v2)
),
"opportunity", tbl1[Opportunity],
"start date" , tbl1[Start Date],
"end date", tbl1[End Date],
"estimated revenue",tbl1[Estimated Revenue],
"monthly revenue", tbl1[Monthly Revenue],
"Date", [Date] & ""

)

var tb2 = 
SELECTCOLUMNS(
    tbl2,
    "Date",tbl2[Dates] & ""
)

var ds3 = 
FILTER(
NATURALINNERJOIN(
    ds1,
    tb2
),
datevalue([Date]) <> datevalue([start date]))



return ds3

 

 

 

let me know if this helps .

 

 

If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠

View solution in original post

1 REPLY 1
Daniel29195
Super User
Super User

@nseward 

output

Daniel29195_0-1708558871670.png

 

 

caluclated table : 

Table 2 = 



var ds = 
ALLNOBLANKROW(tbl1)

var ds1 = 
SELECTCOLUMNS(
GENERATE(
    ds,
    var v1 = tbl1[Start Date]
    var v2 = tbl1[End Date]
    RETURN
    CALENDAR(v1,v2)
),
"opportunity", tbl1[Opportunity],
"start date" , tbl1[Start Date],
"end date", tbl1[End Date],
"estimated revenue",tbl1[Estimated Revenue],
"monthly revenue", tbl1[Monthly Revenue],
"Date", [Date] & ""

)

var tb2 = 
SELECTCOLUMNS(
    tbl2,
    "Date",tbl2[Dates] & ""
)

var ds3 = 
FILTER(
NATURALINNERJOIN(
    ds1,
    tb2
),
datevalue([Date]) <> datevalue([start date]))



return ds3

 

 

 

let me know if this helps .

 

 

If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.