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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Zuz
Frequent Visitor

Forecast and Actuals in one line chart Data model with both relationship

Hi all,

I'm trying to create line chart with forecast and actual data in one line. This is my data model:

datamodel.PNG

I have two filters:

1. Last X days related only to one chart

2. Months with Total - related only to a column chart with 3 measures (therefore I have 2 tables of consumption and forecast)

 

Now I am trying to create a line chart but I have tried removefilters, userelationship, and filter on both tables but I have only the first 4 months' data. I want one column with all months with forecast and another with actuals (based on data).  

 

Incorrect totals for months:

wrong.PNG

Can somebody please help me create the right measures for Forecasts and Actuals? Thank you in advance. 

2 REPLIES 2
amitchandak
Super User
Super User

@Zuz , seem like data is coming from consumption and forecast which are not joined with the Calendar table. It should come from the calendar(2) and forecast(2) . Or you should join the table consumption and forecast with date table. Also, they should not join with each other. they should with common tables

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

I switch the tables and now it returns values only for the first 4 months. 

4monts.PNG

I have two tables due to the column chart. The column chart shows the right values. 

There are these measures:

Total by Month AY = VAR _Total = CALCULATE(SUM('Consumption (2)'[suma_odpoctov_kwh]),ALL(Months_with_Total), 'Consumption (2)'[Year]= 2023) RETURN SWITCH( SELECTEDVALUE('Months_with_Total'[Month Name]), "Total", _Total, CALCULATE( SUM('Consumption (2)'[suma_odpoctov_kwh]), 'Consumption (2)'[Year]= 2023))

 

Total by Month PY = VAR _Total = CALCULATE(SUM('Consumption (2)'[suma_odpoctov_kwh]),ALL(Months_with_Total), 'Consumption (2)'[Year] = 2022) RETURN SWITCH( SELECTEDVALUE('Months_with_Total'[Month Name]), "Total", _Total, CALCULATE( SUM('Consumption (2)'[suma_odpoctov_kwh]), 'Consumption (2)'[Year] = 2022))

Directly in the table Consumption (2). 

 

In the Forecast (2) table is this measure:

Total FC by Month 2 = VAR _Total = CALCULATE(SUM('Forecast (2)'[Spotreba_kWh]),ALL(Months_with_Total)) return SWITCH( SELECTEDVALUE('Months_with_Total'[Month Name]), "Total", _Total, CALCULATE(SUM('Forecast (2)'[Spotreba_kWh]))) 

 

I tried to use both tables for the line chart but had no success. The month's slicer from the Calendar table is inactive for the line chart (I want to have the whole year) and active for the column chart. 

 

 

 

 

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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