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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
Advocate V
Advocate V

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!

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
Advocate V
Advocate V

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!

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.