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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
awitt1Temp
Frequent Visitor

Retrieve data in measure from different tables based on date

I am looking to write a single measure that adds a sales + forecast value for a give month. To do this I have to sum data in a sales table for dates today and earlier with the forecasted amount for future dates that live in a different forecast table. 

 

As a result, prior months would just add up actuals and future months would only sum the forecasted amount. For current month though we would have actuals up through yesterday technically and forecast from today on.

 

For this month, the result should be $253,500 ($241,200 in actuals from 9/1 - 9/18 & $12,300 in forecast from 9/19 - 9/30)

 

DateActual Sales
1-Sep10000
2-Sep $        30,000
3-Sep $        25,000
4-Sep $        10,000
5-Sep $          9,500
6-Sep $              500
7-Sep $              600
8-Sep $        15,000
9-Sep $        10,000
10-Sep $        30,000
11-Sep $        25,000
12-Sep $        10,000
13-Sep $          9,500
14-Sep $              500
15-Sep $              600
16-Sep $        15,000
17-Sep $        10,000
18-Sep $        30,000
19-Sep 
20-Sep 
21-Sep 
22-Sep 
23-Sep 
24-Sep 
25-Sep 
26-Sep 
27-Sep 
28-Sep 
29-Sep 
30-Sep 

 

DateForecast
1-Sep $           950
2-Sep $           950
3-Sep $           950
4-Sep $        1,050
5-Sep $        1,050
6-Sep $        1,050
7-Sep $        1,150
8-Sep $        1,150
9-Sep $        1,150
10-Sep $           950
11-Sep $           950
12-Sep $           950
13-Sep $           950
14-Sep $           950
15-Sep $           950
16-Sep $        1,050
17-Sep $        1,050
18-Sep $        1,050
19-Sep $        1,150
20-Sep $        1,150
21-Sep $        1,150
22-Sep $           950
23-Sep $           950
24-Sep $           950
25-Sep $           950
26-Sep $           950
27-Sep $           950
28-Sep $        1,050
29-Sep $        1,050
30-Sep $        1,050

  

1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@awitt1Temp,

 

Try this solution.

 

1. Create a date table with relationships to each table:

 

DataInsights_0-1663623165468.png

 

2. Create measures:

 

Actual Sales = SUM ( Actual[Actual Sales] )
Forecast = SUM ( Forecast[Forecast] )
Blended Amount = 
VAR vActualEndDate =
    CALCULATE ( MAX ( Actual[Date] ), ALL ( 'Date' ) )
VAR vForecast =
    CALCULATE ( [Forecast], KEEPFILTERS ( 'Date'[Date] > vActualEndDate ) )
VAR vResult = [Actual Sales] + vForecast
RETURN
    vResult

 

3. In a table visual, add Date (must be from Date table) and [Blended Amount]:

 

DataInsights_1-1663623320260.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

2 REPLIES 2
v-henryk-mstf
Community Support
Community Support

Hi @awitt1Temp ,

 

Whether the advice given by @DataInsights  has solved your confusion, if the problem has been solved you can mark the reply for the standard answer to help the other members find it more quickly. If not, please point it out.


Looking forward to your feedback.


Best Regards,
Henry

DataInsights
Super User
Super User

@awitt1Temp,

 

Try this solution.

 

1. Create a date table with relationships to each table:

 

DataInsights_0-1663623165468.png

 

2. Create measures:

 

Actual Sales = SUM ( Actual[Actual Sales] )
Forecast = SUM ( Forecast[Forecast] )
Blended Amount = 
VAR vActualEndDate =
    CALCULATE ( MAX ( Actual[Date] ), ALL ( 'Date' ) )
VAR vForecast =
    CALCULATE ( [Forecast], KEEPFILTERS ( 'Date'[Date] > vActualEndDate ) )
VAR vResult = [Actual Sales] + vForecast
RETURN
    vResult

 

3. In a table visual, add Date (must be from Date table) and [Blended Amount]:

 

DataInsights_1-1663623320260.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.