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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
josh_sheffield
Frequent Visitor

Referencing to a value on the previous day

I am working with time series sensor data which records temperature and relative humidity (see image below).

 

The humidity in the space should not be allowed to increase or decrease by more than 10% RH in 24 hours.

 

I'm wanting to create new columns which show the upper and lower limits for Relative Humidity. i.e. the reading from the same sensor 24 hours ago +/- 10. I've had a look at similar examples but so far have been unable to find a solution.

 

Any help greatly appreciated!

 

Capture.PNG

1 ACCEPTED SOLUTION

Thanks for your response!

I think I have got it sorted... I've included the code I used below so that it might help anyone in the future.

 

RH1 = 
CALCULATE(
    MAX(Full_Period[Relative Humidity])+10,
    FILTER(
        ALL(Full_Period),
    Full_Period[Source.Name] = EARLIER(Full_Period[Source.Name])
    && Full_Period[Date/Time]
    =EARLIER(Full_Period[Date/Time]) - 1
))

View solution in original post

2 REPLIES 2
Greg_Deckler
Super User
Super User

You want to use the EARLIER function.

 

See my article on MTBF which deals with a very similar issue to what you are having:

 

http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/3395...


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thanks for your response!

I think I have got it sorted... I've included the code I used below so that it might help anyone in the future.

 

RH1 = 
CALCULATE(
    MAX(Full_Period[Relative Humidity])+10,
    FILTER(
        ALL(Full_Period),
    Full_Period[Source.Name] = EARLIER(Full_Period[Source.Name])
    && Full_Period[Date/Time]
    =EARLIER(Full_Period[Date/Time]) - 1
))

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.