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
Zyg904
New Member

Return data for nearest date 3 months prior

Hi all,
I'm a newbie to PowerBI and struggling with a look-up for a report.  By way of introduction, I work in a Care Home group and we're using Power BI to analyse some data we're collecting.  

I have a series of individuals who are weighed throughout the month - there is no consistency on dates weighed and multiple people can be weighed on the same day.  I have date (in dd/mm/yyy hh/mm/ss format) of dates weighed.  I have the value of the weight.  What I'd like is the value of the weight for each individual 3 months prior.  

Eg
Resident Name                               Date Weighed                 Weight        Nearest Date 3 months prior           Weight 3 months prior
Bob                                                  01/01/19                         60                        10/11/18                                       55

Jo                                                     10/01/19                         60                         01/01/19                                      58

 

What I'd like to know is how do you find out from [date weighed] the [nearest date 3 months prior] and, from that, lookup the [weight 3 months prior]?

 

Thanks in advance

 

 

1 ACCEPTED SOLUTION
v-eachen-msft
Community Support
Community Support

Hi @Zyg904 ,

 

At first, you need to create a calendar table which contains date you need. Then use DATEADD() function to get [nearest date 3 months prior]. The DAX is like this:

DATEADD(Table[You date column],-3,MONTH)

Then use LOOKUPVALUE() function to get the weight. 

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

1 REPLY 1
v-eachen-msft
Community Support
Community Support

Hi @Zyg904 ,

 

At first, you need to create a calendar table which contains date you need. Then use DATEADD() function to get [nearest date 3 months prior]. The DAX is like this:

DATEADD(Table[You date column],-3,MONTH)

Then use LOOKUPVALUE() function to get the weight. 

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

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.