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

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.

Reply
Kristianhk
Frequent Visitor

Compare a value in row with a measure defining start date of selected time period

Hi All

 

I have a date table. from that I have a slicer defining a time period

then I have two Measures

  • timePeriod_START = CALCULATE(  MIN( DateTable[Date] ) )
  • timePeriod_END = CALCULATE(  MAX( DateTable[Date] ) )


Then I have this Timeline Table 

MID

Status

Start Time

End Time

CNC 28

Production

01-01-2020 09:00:00

01-01-2020 23:00:00

CNC 28

stopped

01-01-2020 23:00:00

02-01-2020 09:00:00

CNC 28

alarm

02-01-2020 09:00:00

02-01-2020 23:00:00

CNC 28

stopped

02-01-2020 23:00:00

03-01-2020 09:00:00

 

I would like to have two new measures:

  • NewStartTime = Maximum of  Timeline[Start time] and [TimePeriod_START]
  • NewEndTime = Minimum of  Timeline[End time] and [TimePeriod_END]

 

I have the following challenges with the two measures:

  1. I have trouble to find a way/functions which can give me a MAX/MIN of a row value and a measure. I have tried with MAXX without any luck, but the issue could be due to the next challenge mentioned below.
  2. the [TimePeriod_START] and [TimePeriod_END] measures is somehow not fixed to the selected time period but is calculated by row,

 

the measure will be used in a "as timeline" Visual to make timelines for my machines. the measures will make sure start and end for each machine is the same in the visual so it looks pretty

 

Any device to finalice the measures would be much appreciated

 

/Kristian

 

 

1 REPLY 1
lbendlin
Super User
Super User

1. is easy to resolve. Just use some form of meaningless aggregation against your row value

 

measure = max (max(Timeline[Start time]),Timeperiod_START)

 

etc.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors