0
votes

I've a table like below in Power BI with only the start and end date with the value between this dates.

Start_date End_date Value
2020-12-01 2020-12-03 7
2020-12-04 2020-12-17 8
2020-12-18 2020-12-21 6
2020-12-22 2099-12-31 7

How could I show the value of a specific day (e.g. on 2020-12-20 the show value be 6) using a measure?

2

2 Answers

1
votes

If your specific day is in DateTable then write for example:

Measure = calculate( max('Table'[Value]), FILTER(ALL('Table'), 
'Table'[Start_date]<=  SELECTEDVALUE(DateTable[Date])  
&&   SELECTEDVALUE(DateTable[Date])  <=  'Table'[End_date]  )
)
1
votes

Let's suppose you set the specific day using a slicer DimDate[Date].

Then you can write your measure like this:

Measure =
VAR DateSelected = SELECTEDVALUE ( DimDate[Date] )
RETURN
    SUMX (
        FILTER (
            Table1,
            Table1[Start_date] <= DateSelected &&
            Table1[End_date] >= DateSelected
        ),
        Table1[Value]
    )