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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
stevehuff
Frequent Visitor

Creating a calculated column that depends on two different conditions

Hello! New to PowerBI and hoping that I can get some assistance in building out a report. We're looking to generate a report to show the percentage increase/decrease for lease amounts tied to the same building. The report would need to look to see 1) If the building is the same and 2) Calculate the percentage increase or decrease depending on if there is a prior move-in date for the building. If there is no prior move-in date or it is the sole record for the building, then the calculation would not run and the value would be left blank.

 

Based on how I have currently sourced/sorted the data, it looks something along the lines of this: 

BuildingMove-In DateRent

Building 1

10/20/2022

$1,500

Building 108/04/2023$1,650
Building 205/10/2023$1,700
Building 304/02/2021$1,650
Building 308/10/2023$1,600
Building 401/01/2022$1,800

 

From what I have been reading, it seems like a calculation would be the best method on how to generate the increases/decreases, but I'm a little lost on how to write the formula to calculate the percent increases only when the building name is the same and there is a previous move-in date value. Once complete, we'd want the report to look something along the lines of this:

BuildingMove-In DateRentPercent Increase/Decrease
Building 110/20/2022$1,500 
Building 108/04/2023$1,650+10%
Building 205/10/2023$1,700 
Building 304/02/2021$1,650 
Building 308/10/2023$1,600-3%
Builidng 401/01/2022$1,800 


Any and all help would be appreciated. Thanks in advance! 😁

1 ACCEPTED SOLUTION

@stevehuff 

is your data format correct? pls make sure the move in date is date type.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

6 REPLIES 6
stevehuff
Frequent Visitor

That worked @ryan_mayu. Thank you so much! Thanks for your suggestion as well @Ashish_Mathur

you are welcome





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Ashish_Mathur
Super User
Super User

Hi,

Write these calculated column formulas

Previous rent = LOOKUPVALUE(Data[Rent],Data[Move-In Date],CALCULATE(MAX(Data[Move-In Date]),FILTER(Data,Data[Building]=EARLIER(Data[Building])&&Data[Move-In Date]<EARLIER(Data[Move-In Date]))),Data[Building],Data[Building])
Rent growth (%) = DIVIDE(([Rent]-[Previous rent]),[Previous rent])

Hope this helps.

Ashish_Mathur_0-1700017841539.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
ryan_mayu
Super User
Super User

@stevehuff 

you can try this

Column = 
VAR _last=maxx(FILTER('Table','Table'[Building]=EARLIER('Table'[Building])&&'Table'[Move-In Date]<EARLIER('Table'[Move-In Date])),'Table'[Move-In Date])
return if(ISBLANK(_last),BLANK(),'Table'[Rent]/maxx(FILTER('Table','Table'[Building]=EARLIER('Table'[Building])&&'Table'[Move-In Date]=_last),'Table'[Rent])-1)

11.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hey @ryan_mayu 

Thanks for the help! I'm still having some difficulties here. When I entered this in, I got the following error message. Any ideas on how/where to convert the Value/Format function?ScreenshotSample.jpg

@stevehuff 

is your data format correct? pls make sure the move in date is date type.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.