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.
Hi guys,
I have the table below and I would like to have a line chart similar to the chart below, showing the actual numbers until June 2022, and from July to December showing the forecast.
Month Date comes from Calendar table.
Actuals from the FACT Table Actuals
Forecast from Forecast table.
I know it's wrong, but this is the logic I have in mind.
I'd greatly apprecite your help on that.
Thank you.
Solved! Go to Solution.
Hi @ROG ,
Try creating two measure to dictate whether it should take Actuals or Forecast and then adding them to your Y axis in the line chart. You will then get two line colours. I assume you have a Date column in your Calendar table.
Actual Measure:
Actual =
CALCULATE(SUM('ACtual Table'[Actual]),'Actual Table'[Date]=MAX('Calendar Table'[Date]),
'Calendar Table'[Date]<DATE(2022,07,01))
Forecast Measure:
Forecast =
CALCULATE(SUM('Forecast Table'[Forecast]),'Forecast Table'[Date]=MAX('Calendar Table'[Date]),
'Calendar Table'[Date]>DATE(2022,06,01) && 'Calendar Table'[Date]<=DATE(2022,12,31))
Only issue is if you put them in the graph, the lines will be disconnected
If you want the two lines to connect, you can extend the Actual to include the Forecast for July. If you want to do that, then replace the Actual Measure with this:
Actual with July Forecast=
VAR _Julyforecast=MAX('Calendar Table'[Date])=DATE(2022,07,01) && MAX('Calendar Table'[Date])<=DATE(2022,07,31)
VAR _UntilJune22=MAX('Calendar Table'[Date])<DATE(2022,07,01)
RETURN
IF(_Julyforecast , CALCULATE(SUM('Forecast Table'[Forecast]),'Forecast Table'[Date]=MAX('Calendar Table'[Date])),
IF(_UntilJune22,CALCULATE(SUM('Actual Table'[Actual]),'Actual Table'[Date]=MAX('Calendar Table'[Date]))))
Hi @ROG,
Could you send me a sample pbix file with dummy data? That will help me understand the columns in your tables and relationships so I can come up with a solution there for you to implement.
Hi @ROG ,
Try creating two measure to dictate whether it should take Actuals or Forecast and then adding them to your Y axis in the line chart. You will then get two line colours. I assume you have a Date column in your Calendar table.
Actual Measure:
Actual =
CALCULATE(SUM('ACtual Table'[Actual]),'Actual Table'[Date]=MAX('Calendar Table'[Date]),
'Calendar Table'[Date]<DATE(2022,07,01))
Forecast Measure:
Forecast =
CALCULATE(SUM('Forecast Table'[Forecast]),'Forecast Table'[Date]=MAX('Calendar Table'[Date]),
'Calendar Table'[Date]>DATE(2022,06,01) && 'Calendar Table'[Date]<=DATE(2022,12,31))
Only issue is if you put them in the graph, the lines will be disconnected
If you want the two lines to connect, you can extend the Actual to include the Forecast for July. If you want to do that, then replace the Actual Measure with this:
Actual with July Forecast=
VAR _Julyforecast=MAX('Calendar Table'[Date])=DATE(2022,07,01) && MAX('Calendar Table'[Date])<=DATE(2022,07,31)
VAR _UntilJune22=MAX('Calendar Table'[Date])<DATE(2022,07,01)
RETURN
IF(_Julyforecast , CALCULATE(SUM('Forecast Table'[Forecast]),'Forecast Table'[Date]=MAX('Calendar Table'[Date])),
IF(_UntilJune22,CALCULATE(SUM('Actual Table'[Actual]),'Actual Table'[Date]=MAX('Calendar Table'[Date]))))
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
97 | |
84 | |
67 | |
60 |
User | Count |
---|---|
150 | |
120 | |
99 | |
87 | |
68 |