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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Create a table with time series between two dates FOR EACH project in project table

Hi,

 

I trying to establish a time series data set to serve as input for a line chart in DAX. 

 

Below is a sample Projects table of my starting point.

 

ProjectID  TimeRegistrationDateMin  StatusReportDateMax
101-01-202005-01-2020
210-01-202013-01-2020
320-01-202027-01-2020

 

To ensure all dates between the [TimeRegistrationDateMin] and [StatusReportDateMax] are available as row entries in the to-be table, I have tried using the GENERATESERIES() function. However, I cannot get my head around how to loop over each project of the Projects table, to produce a time series for each project in the same output table.

 

Desired output is as follows: 

ProjectID  Date
101.10.2020
102.10.2020
103.10.2020
104-01-2020
105-01-2020
210-01-2020
211-01-2020
212-01-2020
213-01-2020
320-01-2020
321-01-2020
322-01-2020
323-01-2020
324-01-2020
325-01-2020
326-01-2020
327-01-2020

 

In PQ, I have managed to to this by adding a custom column containing a list between the two dates for each project, and the expanded the lists of the column. However, due to performance, this needs to be computed in DAX.

 

Thanks in advance for your time and input! 

 

3 REPLIES 3
dedelman_clng
Community Champion
Community Champion

Hi @Anonymous -

 

You can use the GENERATE function

 

TimeSeries =
GENERATE (
    Project,
    FILTER (
        ALL ( DateTab[Date] ),
        DateTab[Date] <= Project[StatusReportDateMax]
            && DateTab[Date] >= Project[TimeRegistrationDateMin  ]
    )
)

 

2020-10-15 08_00_35-scratch4 - Power BI Desktop.png

 

Hope this helps

David

David, where should I paste the "GENERATE" code? Should it be pasted in New Query?

No, you will put it in a "New Table" DAX formula.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors