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
Anonymous
Not applicable

New table column with GenerateSeries()

Hello eveyone,

 

i'm new with DAX and i face to a problem.

I have a table from my SQL Server database where I have 3 columns BillingDate; Recurrence (Month / Year); periodicity (a number)

 

I'd like to generate a billing forecast for the next 3 years.

For that, I want to create a table column for each rows which contain all my next billing date occurencies. Is it possible?

 

----------------------------------------------------------------------------------------------------------
Ex:
Current billing date: 01/01/2020
Recurrence: Month
Periodicity: 3

I would like to generate a table column for the next 3 years like that:
04/01/2020; 07/01/2020; 10/01/2020; 01/01/2021; 04/01/2021; 07/01/2021; 10/01/2021; ....
----------------------------------------------------------------------------------------------------------

 

For that, i've generated a first new column 'MonthRecurrency' which calculate how many month I have to add basing to my 'Recurrence' column and my 'Periodicity' column.

 

To finish, I used the DAX function GenerateSeries() like this:

GENERATESERIES('MyTable'[BillingDate].[Date]; DATEADD('MyTable'[BillingDate].[Date]; 36; MONTH); MaTable[MonthRecurrency])

 

Yet, I have an error: "GenerateSeries arguments cannont be empty"

Am I on the good way, and if 'Yes', can you help me to find my mistake plz?

 

1 ACCEPTED SOLUTION

@Anonymous ,

 

If you consider it as a solution, please mark as a solution and kudos. So we can close this topic and help others.

 

Ricardo

 



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



View solution in original post

7 REPLIES 7
camargos88
Community Champion
Community Champion

Hi @Anonymous ,

 

I've created an example using Power Query, take a look on Advanced Editor.

 

File: Download PBIX 

 

Ricardo



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Anonymous
Not applicable

Hi @camargos88 ,

 

First, thank you for replying.

if I correctly understand what you have done, you generated a column DateTime type for the forecast date?

 

But, in my case, I need to generate a list of date for each rows on a period.

 
 

If I take one row of your example:

Billing date: 01/01/2020

Recurrence: Month

Periodicity: 3

 

Forecast date example.jpg

 

 

For this row, i'm waiting for a ForecastDate like this (a table): {04/01/2020; 07/01/2020; 10/01/2020; 01/01/2021; 04/01/2021; ...}

Is is possible to generate something like this for each rows of my tab?

 

Best regards,

Hi @Anonymous ,

 

This code creates a range of dates, take a look at the steps on Power Query. First it get the recurrence for each row and generate a list of dates based on it. After that it expands the list on new rows, so the first 3 columns will be repeated with the new dates.

 

Do you need just the first date for each month or the range ?

 

Ricardo



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Anonymous
Not applicable

Ok, i now understand what you did.

While doing a DateTime table column as I expect you duplicate each row with the forecast date I expected. It's clever.

I will try your adanced query on my project.

 

I will give you a feedback.

 

Thank again for the help 

@Anonymous ,

 

Doesn't work if you have a date table with all you dates ?

What do you want as result ?

 

Ricardo



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Anonymous
Not applicable

Your reply seems logic and should work in my case, so what I expected don't matter.

Your solution seems to be better than mine. 

As I said i'm new in Dax language so my option was probably not the good way to do such a thing.

@Anonymous ,

 

If you consider it as a solution, please mark as a solution and kudos. So we can close this topic and help others.

 

Ricardo

 



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



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.