Forum Discussion

Brighton10's avatar
Brighton10
Helper II
5 years ago
Solved

get yesterday's date dynamically

Hello!

I find myself manually editing my date in my measure daily and am looking for a way to make it dynamically change with time. This is the measure:

DieselFlowOver40l/hr Count =
VAR countryname_ = SELECTEDVALUE(_CountryKey[country])
VAR region_ = SELECTEDVALUE(Analog[region])
VAR sitename_ = SELECTEDVALUE(Analog[siteName])
VAR datetime_ = SELECTEDVALUE(Historical[dateTime])
VAR max_Diesel_Flow_Over40 = CALCULATE(COUNTROWS(Historical),
Historical[alarmCode]="DieselFlowOver40",
FILTER(Historical,Historical[country]=countryname_),
Historical[region]=region_,Historical[siteName]=sitename_,Historical[alarmStatus]="ON",FILTER(Historical,Historical[dateTime]>=DATE(2021,02,14)))
RETURN
max_Diesel_Flow_Over40
 
I also want the measure to display a ZERO when there is nothing instead of a blank as it is doing now. Thanks
  • Brighton10 , Expected output not very clear

    This will make it dynamic

    FILTER(Historical,Historical[dateTime]>=today() -1))

4 Replies

  • Brighton10 , Expected output not very clear

    This will make it dynamic

    FILTER(Historical,Historical[dateTime]>=today() -1))

    • Brighton10's avatar
      Brighton10
      Helper II

      Hi amitchandak , Thanks for that i think i made an error coz i tried this at some point but its working now. The other thing is this measure counts the rows when my alarm is ON. It only displays values if its greater than 0 but I also want to display when the alarm is OFF and display a 0