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
Brighton10
Helper II
Helper II

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
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Brighton10 , Expected output not very clear

This will make it dynamic

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

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@Brighton10 , Expected output not very clear

This will make it dynamic

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

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

@Brighton10 , add +0

RETURN
max_Diesel_Flow_Over40+0

 

and try

That solution will distort my other valuesinput.PNGoutput2.PNG

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.