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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
mfallmann
Regular Visitor

Creating table containing future data based on rules

Dear All, 

I need to pick your brains on this one:

I have a table containing contract Id, contract value, contract starting date and invoice frequency (monthly, bimonthly, quarterly, every 6 months , yearly)

 

Based on this data, I would like to be able to display all expected invoices in the coming x years.

 

My first idea on achieving this was to create a new table based on the input I have in my contract table.

Would anyone of you have a suggestion how I can get this done?

 

Many thanks in advance!

2 REPLIES 2
bhelou
Responsive Resident
Responsive Resident

ve this a try : 

Expected Invoice =
var start_date = MIN(Contracts[Starting Date])
var invoice_period = MAX(Contracts[Invoice Period])
var invoice_value = MAX(Contracts[Contract Value])
return
ADDCOLUMNS(
FILTER(
CALENDAR(start_date, DATEADD(MAX(Calendar[Date]), X, MONTH)),
MOD(DATEDIFF([Date], start_date, MONTH), invoice_period) = 0
),
"Contract ID", MAX(Contracts[Contract ID]),
"Invoice Value", invoice_value
)


Replace "X" in the formula with the number of months you want to display the invoices for.

Thanks for the fast response.

However, this way I get a table with just one contract ID, and all days of the months we should invoice until X is reached ...

I am looking for a table containing only contracts with the dates they are expected to be invoiced ...  

Every contract can have a different invoice starting date, and invoicing period

 

This is an example of what I have (the actual no of contracts will be in the mid-hundreds):

Contract IDStarting DateIF frequency (months)
Contract 101.01.20224
Contract 201.05.20226

 

This is what I expect:

Contract IDIV Date
Contract 101.01.2022
Contract 101.05.2022
Contract 101.09.2022
Contract 101.01.2023
Contract 101.05.2023
Contract 101.09.2023
Contract 101.01.2024
Contract 101.05.2024
Contract 101.09.2024
Contract 201.11.2022
Contract 301.05.2023
Contract 401.11.2023
Contract 501.05.2024
Contract 601.11.2024

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.