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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
frankhofmans
Helper IV
Helper IV

Measure to combine past and future

hi Pbi experts,

 

i have three tables, a date table, an actuals table and a capacity table:

 

Actuals table

 

DateID# Hours
01-01-2024O11110
01-02-204O11215
01-03-2024O11312
20-03-2024O11420
01-05-2024O11512
01-06-2024O11615
01-07-2024O11714

 

Capacity table

 

DateCapacity IDHours
01-01-2024C11115
01-02-2024C11220
01-03-2024C11317
01-04-2024C11420
01-05-2024C11521
01-06-2024C11722
01-07-2024C11823
01-08-2024C11921
01-09-2024C12022

 

Both tables have a direct relation with the date table. I want to creature a graph with 1 line which combines past and future. So for all selected dates before today i want to show the actuals hours and for all selected dates after today i want to show the capacity hours. So if it's feb. 12th and i select 2024, from jan. 1 till feb. 12 i want to show the actuals and from feb. 13 to dec. 31 i want to show the capacity hours, in one line.

 

Do you have an solution for me?

 

Many thanks in advance,

Regards, Frank

2 ACCEPTED SOLUTIONS
timalbers
Super User
Super User

Hi @frankhofmans 

 

you could create a measure like the following:

new_measure = 
    SWITCH( TRUE(),
        MIN( date_table[Date] ) <= TODAY(), SUM( Actuals[Hours] ),
        SUM( Capacity[Hours] )
    )

 

Cheers

Tim

_____

If this post helped you, please consider marking it as solution, thank you!


—————————————————————————————
If my answer helped you, please consider marking it as a solution
— it helps the community and makes DAX errors feel less lonely

View solution in original post

TDK
Frequent Visitor

Hi Frank,


This should work and will show actuals when available and capacity when actuals are not available, this would not be limited capacity for after today, meaning that even if today’s data is missing it will show something :).

 

Actuals and Capacity =
//this shows actuals if available, and defaults to showing capacity 
var _actuals = SUM('Actuals'[Hours])
var _capacity = SUM('Capacity'[Hours])
RETURN
if(ISBLANK(_actuals), _capacity,_actuals)

 

If you need this to specifically draw the line on today the following would do that:

Actuals and Capacity =
//this shows actuals for dates up to today, and after today show values from capacity
var _actuals = CALCULATE(SUM('Actuals'[Hours]),FILTER('your_date_table',[Date] <= Today()))
var _capacity = CALCULATE(SUM('Capacity'[Hours]),FILTER('your_date_table',[Date] > Today()))
RETURN
_capacity+_actuals

 

My only caveat with these solutions is as soon as you filter using a value from Actuals or Capacity, your graph will show values only from either and not from both. Shout if this is an issue and I can help with an alternative :).

 

Thanks,

Tian

View solution in original post

2 REPLIES 2
TDK
Frequent Visitor

Hi Frank,


This should work and will show actuals when available and capacity when actuals are not available, this would not be limited capacity for after today, meaning that even if today’s data is missing it will show something :).

 

Actuals and Capacity =
//this shows actuals if available, and defaults to showing capacity 
var _actuals = SUM('Actuals'[Hours])
var _capacity = SUM('Capacity'[Hours])
RETURN
if(ISBLANK(_actuals), _capacity,_actuals)

 

If you need this to specifically draw the line on today the following would do that:

Actuals and Capacity =
//this shows actuals for dates up to today, and after today show values from capacity
var _actuals = CALCULATE(SUM('Actuals'[Hours]),FILTER('your_date_table',[Date] <= Today()))
var _capacity = CALCULATE(SUM('Capacity'[Hours]),FILTER('your_date_table',[Date] > Today()))
RETURN
_capacity+_actuals

 

My only caveat with these solutions is as soon as you filter using a value from Actuals or Capacity, your graph will show values only from either and not from both. Shout if this is an issue and I can help with an alternative :).

 

Thanks,

Tian

timalbers
Super User
Super User

Hi @frankhofmans 

 

you could create a measure like the following:

new_measure = 
    SWITCH( TRUE(),
        MIN( date_table[Date] ) <= TODAY(), SUM( Actuals[Hours] ),
        SUM( Capacity[Hours] )
    )

 

Cheers

Tim

_____

If this post helped you, please consider marking it as solution, thank you!


—————————————————————————————
If my answer helped you, please consider marking it as a solution
— it helps the community and makes DAX errors feel less lonely

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.