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
patrickbender
Helper I
Helper I

Generate new rows based on previous data

Hi,

I have two tables, one with accounting and one with forcasts.

I need to use both in order to create a view with some information I need for my accounting.

The problem is mainly with the forecasts as I need one row for each month since the start of the project until the current month.

I appreciate all help and pointers to a good read is also much appreciated.

 

Problem 1: There's not a forcast during some months (mainly summer) and that forecast needs to be the same at the previous one.

Problem 2: After the project is completed I still need to have the last forecast on a new row for each month after that as I always need a running total. 

 

Link: .pbix link 

 

My first thought was to use a date calendar which matched the forecast to the correct dates but as I want to use the numbers in calculated columns that didn't work out.

My second thought was to make one row for each month and project and then add calculated columns. I tried with a foor loop using generate series but I could only get that to work for one dimention and not two (month and project).

 

In the picture below:

Nov, Feb & Mar is not included in the datasef of the forecast table and is therefore the same as previous date for project 1

 

ProjectedRevenue: Ssum of type revenue in the foercast table grouped by date and project. 

ProjectedCost: Sum of type cost in the foercast table grouped by date and project.

Invoiced: Sum of all invoices in the accounting table until the date in the month column.

PostedCost: Sum of all posted costs in the accounting table until the date in the month column.

Picture1.png

2 REPLIES 2
Greg_Deckler
Super User
Super User

So, in general, when you are trying to invent rows in DAX, you use GENERATE or GENERATESERIES

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hi,
I tried the generate series as you mentioned a while back but got stuck as I need to loop though 2 dimensions, date and project. This would be fine if there was a loop in Dax but I searched for it and couldn’t find any except using a second table.

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