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
trader
Frequent Visitor

Extra rows so that all periods have a value

Hi

 

I am building a forecast YTD chart that has the months along the x-axis and the YTD values on the Yaxis. If the month has been we use actuals otherwise we use the forecast monthly values.

 

I have encountered some problem with my SAP data.  Basically for some cost lines I have actuals but since we have spent our budget we have nothing entered in the forecast (i.e. for these lines the max row I have is the last actual period).  For other lines then I have values for every period in either the actual or forecast columns.

 

I have created a dummy table with every combination (my data has profit centre and cost elements)  which is quite large and then used merge to get the extra rows into the dataset (i.e. ensure I have a period 12 for all profit centre and cost element combo), however this seems like an ineffienct solution.  

 

Is there an easier way?

 

thanks

2 REPLIES 2
v-chuncz-msft
Community Support
Community Support

@trader,

 

Given a period table, you may just use DAX to add a measure.

https://docs.microsoft.com/en-us/power-bi/desktop-tutorial-create-measures

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-chuncz-msft

 

Hi, thanks for your reply.  I am relatively new to this tool so please forgive my question as I am struggling to understand

 

I create a simple view of my dataset below.

 

Table 1

 

LocationPeriodActFcst
C15050
D15050
A26060
C34242
C47070
W58080
D61010
A62020
W62626
A8 40
D9 50
C10 60
C12 70
W12 80

 

 

 

My next table is called Date

PeriodMonth
11/07/2017
21/08/2017
31/09/2017
41/10/2017
51/11/2017
61/12/2017
71/01/2018
81/02/2018
91/03/2018
101/04/2018
111/05/2018
121/06/2018

 

I then created 2 measure based on readings

 

Measure 1 = Sum(Table1[Act])

Measure 2 = TOTALYTD([Measure1],'Date'[Month])

 

I also tried a new column with TOTALYTD(sum(Table1[Amt]),'Date'[Month],filter(Table1,Table1[Location]=earlier(Table1[Location]))) which gives me the right numbers for the periods where this is data but still misses out the periods where there is not any.

 

What I am looking to see is a table/chart that for Location C above would look like

 

For Filter on Location = C (the yellow highlighted rows are missing and therfore distorting my chart, this is especially a problme if period 12 is missing)

 

LocationPeriodtest
Christchurch150
Christchurch250
Christchurch392
Christchurch4162
Christchurch5162
Christchurch6162
Christchurch7162
Christchurch8162
Christchurch9162
Christchurch10222
Christchurch12292

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.