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
Calvin69
Helper III
Helper III

Flag and calculate a rent value once tenant's name is changed

Hello everyone,

I really appreciate your help with this in advance, I have been trying to make it work for ages and failed miserably so far.

 

I have a consolidated data table that receives new entries every time a user modifies a SharePoint List. Within this table, multiple Properties, Buildings, Units and tenants are registered.

Keys:

  • A Property (PropertyN) consists of Building/s, a Building (BuidlingN) consists of rooms or floors (Title - Location) and each location is assigned to a Tenant (TenantN)

Several KPIs are required, one of which is to have a measure or a new column that would allow me to register (Rent value) whenever a Tenant Value is changed from "Vacant" to "Tenant Name" or from a "Tenant Name" to a "New Tenant Name".

 

I have added indexes to group all different category with a single code but not so sure how to put them into a good use.

 

Please view my attached sample data file.

https://docs.google.com/spreadsheets/d/1FLooqHK_mv3XJAsVBo5SVh2Ap4027c3E/edit?usp=sharing&ouid=10088... 

Calvin69_0-1630192804314.png

 

Thanks

H

 

4 REPLIES 4
Greg_Deckler
Super User
Super User

@Calvin69 See my article on Mean Time Between Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/3395....
The basic pattern is:
Column = 
  VAR __Current = [Value]
  VAR __PreviousDate = MAXX(FILTER('Table','Table'[Date] < EARLIER('Table'[Date])),[Date])

  VAR __Previous = MAXX(FILTER('Table',[Date]=__PreviousDate),[Value])
RETURN
  __Current - __Previous


Follow on LinkedIn
@ 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...

Hi @Greg_Deckler ,

I really apprecaite your feedback on this.

I have followed your instructions above but it seems that I am still doing somthing wrong:

 

Dax Code

 

PBICOM = 
    VAR Curren = '04ConsolidatedEntries'[Rent]
    VAR PreviousDate = MAXX(
                        FILTER('04ConsolidatedEntries','04ConsolidatedEntries'[StartDate.Element:Text] <
                            EARLIER('04ConsolidatedEntries'[StartDate.Element:Text])), '04ConsolidatedEntries'[StartDate.Element:Text])

    VAR Previous = MAXX(FILTER('04ConsolidatedEntries',[StartDate.Element:Text] = PreviousDate), [Rent])
RETURN
  Curren - Previous

 

Table:

Calvin69_1-1630250033891.png

 

Expected values/behaviour are hilighted within the green column.

 

Thanks

H

 

@Calvin69 Can you post sample data?


Follow on LinkedIn
@ 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...

Hi @Greg_Deckler 

 

Sure : https://drive.google.com/drive/folders/1-nhx9yKcLrrH3fcL-V3O7Kb4eSkdRKrH?usp=sharing 

PropertyN InclusiveBuildGroupIndex1BuildingN InclusiveTitleGroupIndex1TitleTenantGroupIndexTenantN InclusiveStartDate.Element:TextEndDate.Element:TextVACorNot!Index0Index1RentPBICOMExpected
Test Test Data Property27TES Test Data Building155Our Test Destination11Vacant01/01/2018 00:0031/12/20191729730 -75500 
Test Test Data Property27TES Test Data Building155Our Test Destination65Power BI Limited01/01/2018 00:0031/12/201907307312000-73500 
Test Test Data Property27TES Test Data Building155Our Test Destination65Power BI Limited01/01/2018 00:0031/12/201907317324000-71500 
Test Test Data Property27TES Test Data Building156Our Test Destination / V265Power BI Limited01/01/2018 00:0031/12/201907327334000-71500 
Test Test Data Property27TES Test Data Building156Our Test Destination / V265Power BI Limited01/01/2018 00:0031/12/201907337344000-71500 
Test Test Data Property27TES Test Data Building156Our Test Destination / V265Power BI Limited01/01/2020 00:0031/12/202107347358000-56568 
Test Test Data Property27TES Test Data Building156Our Test Destination / V265Power BI Limited01/01/2020 00:0031/12/2021073573610000-54568 
Test Test Data Property27TES Test Data Building156Our Test Destination / V265Power BI Limited01/01/2020 00:0031/12/2021073673710000-54568 
Test Test Data Property27TES Test Data Building156Our Test Destination / V265Power BI Limited01/01/2020 00:0031/12/2021073773810000-54568 
Test Test Data Property27TES Test Data Building156Our Test Destination / V265Power BI Limited01/01/2020 00:0031/12/2021075275310000-54568 
Test Test Data Property27TES Test Data Building156Our Test Destination / V265Power BI Limited01/01/2020 00:0031/12/2021075375410000-5456810000
Test Test Data Property27TES Test Data Building156Our Test Destination / V211Vacant01/01/2020 00:0031/12/202117697700-64568 
Test Test Data Property27TES Test Data Building156Our Test Destination / V211Vacant01/01/2020 00:0031/12/202117707710-64568 
Test Test Data Property27TES Test Data Building156Our Test Destination / V211Vacant01/01/2020 00:0031/12/2021177177225000-39568 
Test Test Data Property27TES Test Data Building156Our Test Destination / V211Vacant01/01/2020 00:0031/12/2021177277335000-29568 
Test Test Data Property27TES Test Data Building156Our Test Destination / V211Vacant01/01/2020 00:0031/12/202117737745000-59568 
Test Test Data Property27TES Test Data Building156Our Test Destination / V211Vacant01/01/2020 00:0031/12/202117747755000-59568 
Test Test Data Property27TES Test Data Building156Our Test Destination / V211Vacant01/01/2020 00:0031/12/202117757765000-59568 
Test Test Data Property27TES Test Data Building156Our Test Destination / V211Vacant01/01/2020 00:0031/01/202217767775000-59568 
Test Test Data Property27TES Test Data Building156Our Test Destination / V211Vacant01/01/2020 00:0006/02/202217777785000-59568 
Test Test Data Property27TES Test Data Building156Our Test Destination / V211Vacant01/01/2020 00:0006/02/202217787798000-56568 
Test Test Data Property27TES Test Data Building156Our Test Destination / V266MCdo01/01/2020 00:0006/02/2022077978012000-52568 
Test Test Data Property27TES Test Data Building156Our Test Destination / V266MCdo01/01/2020 00:0006/02/202201896189712000-52568 
Test Test Data Property27TES Test Data Building156Our Test Destination / V266MCdo01/01/2020 00:0006/02/202201897189812000-52568 
Test Test Data Property27TES Test Data Building156Our Test Destination / V266MCdo01/01/2020 00:0006/02/202201898189920000-4456820000
Test Test Data Property27TES Test Data Building180Mansion Central - Test77Fresh Water LTD01/06/2020 00:0001/06/2021018991900500004170050000
Test Test Data Property27TES Test Data Building180Mansion Central - Test78Bozo Fishing LTD01/06/2020 00:0001/06/202101900190110000091700 
Test Test Data Property27TES Test Data Building180Mansion Central - Test78Bozo Fishing LTD01/06/2020 00:0001/06/202101901190210000091700 
Test Test Data Property27TES Test Data Building180Mansion Central - Test78Bozo Fishing LTD01/06/2020 00:0001/06/2021019021903120000111700 
Test Test Data Property27TES Test Data Building180Mansion Central - Test78Bozo Fishing LTD01/06/2020 00:0001/06/2022019031904120000111700 
Test Test Data Property27TES Test Data Building180Mansion Central - Test78Bozo Fishing LTD01/06/2020 00:0001/06/2022019041905120000111700120000
             Total200000

Thanks

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.