Forum Discussion
Calculations based on Selected Date Selected and set Flags
- 3 years ago
Good Point ...
This is what needs to Happen ...
If we select 31/07/23
For (Out-Properties with Lease End Date as at Financial Year To Date)
We need to count the Number of Properties in the Financial Year to date (EOMRPT) 31/07/23 is Selected ... so that means all properties with a (Lease End Date) betweem 1/07/23 to 31/07/24
For (Out-Properties with Lease End Date in Previous Financial Year)
We need to count the Number of Properties in the Previous Year so if (EOMRPT) = 31/07/23 ... it means all properties with a (Lease End Date) betweem 1/07/22 to 30/06/23
BRAZIL OUT ....:( Vai Portugal 🙂
- 3 years ago
HI Alice_Cooper ,
try the following codes:
Out-Properties with Lease End Date in Previous Financial Year = VAR OPFYYTD = CALCULATE ( DISTINCTCOUNT ( Leases[Property ID] ), FILTER ( ALL ( Leases ), Leases[EOMRPT] <= EOMONTH ( MAX ( EOMRPT[EOMRPT] ), 0 ) && Leases[EOMRPT] >= DATE ( YEAR ( MAX ( EOMRPT[EOMRPT] ) ) - 1, MONTH ( MAX ( EOMRPT[EOMRPT] ) ), 1 ) ) ) RETURN IF ( NOT ( ISBLANK ( OPFYYTD ) ), OPFYYTD, 0 ) Out-Properties with Lease End Date as at Financial Year To Date = VAR OATFY = CALCULATE ( DISTINCTCOUNT ( Leases[Property ID] ), FILTER ( ALL ( Leases ), Leases[EOMRPT] >= EOMONTH ( MAX ( EOMRPT[EOMRPT] ), -1 ) + 1 && Leases[EOMRPT] <= EOMONTH ( DATE ( YEAR ( MAX ( EOMRPT[EOMRPT] ) ) + 1, MONTH ( MAX ( EOMRPT[EOMRPT] ) ), 1 ), 0 ) ) ) RETURN IF ( NOT ( ISBLANK ( OATFY ) ), OATFY, 0 ) - 3 years ago
Hi Alice_Cooper ,
Use the following measure:
Active Houses V1 = COUNTROWS ( CALCULATETABLE ( Leases, Leases[Lease Start Date] <= MAX ( DimDate[End of Month] ), CROSSFILTER ( DimDate[Date], Leases[EOMRPT], NONE ) ) ) - COUNTROWS ( CALCULATETABLE ( Leases, Leases[Effective Lease End Date] <= MAX ( DimDate[End of Month] ), CROSSFILTER ( DimDate[Date], Leases[EOMRPT], NONE ) ) )Using the new measure has bubble size you get:
Hi Alice_Cooper ,
The issue on this two metrics is the end of the lease date since you can have more than one year how do you select the year that you should consider ?
In the example above do you consider 2024 or 2025 or both? be aware that we are selected calendar year 2023.
Good Point ...
This is what needs to Happen ...
If we select 31/07/23
For (Out-Properties with Lease End Date as at Financial Year To Date)
We need to count the Number of Properties in the Financial Year to date (EOMRPT) 31/07/23 is Selected ... so that means all properties with a (Lease End Date) betweem 1/07/23 to 31/07/24
For (Out-Properties with Lease End Date in Previous Financial Year)
We need to count the Number of Properties in the Previous Year so if (EOMRPT) = 31/07/23 ... it means all properties with a (Lease End Date) betweem 1/07/22 to 30/06/23
BRAZIL OUT ....:( Vai Portugal 🙂
- MFelix3 years ago
Super User
HI Alice_Cooper ,
try the following codes:
Out-Properties with Lease End Date in Previous Financial Year = VAR OPFYYTD = CALCULATE ( DISTINCTCOUNT ( Leases[Property ID] ), FILTER ( ALL ( Leases ), Leases[EOMRPT] <= EOMONTH ( MAX ( EOMRPT[EOMRPT] ), 0 ) && Leases[EOMRPT] >= DATE ( YEAR ( MAX ( EOMRPT[EOMRPT] ) ) - 1, MONTH ( MAX ( EOMRPT[EOMRPT] ) ), 1 ) ) ) RETURN IF ( NOT ( ISBLANK ( OPFYYTD ) ), OPFYYTD, 0 ) Out-Properties with Lease End Date as at Financial Year To Date = VAR OATFY = CALCULATE ( DISTINCTCOUNT ( Leases[Property ID] ), FILTER ( ALL ( Leases ), Leases[EOMRPT] >= EOMONTH ( MAX ( EOMRPT[EOMRPT] ), -1 ) + 1 && Leases[EOMRPT] <= EOMONTH ( DATE ( YEAR ( MAX ( EOMRPT[EOMRPT] ) ) + 1, MONTH ( MAX ( EOMRPT[EOMRPT] ) ), 1 ), 0 ) ) ) RETURN IF ( NOT ( ISBLANK ( OATFY ) ), OATFY, 0 )- Alice_Cooper3 years ago
Helper II
Thank you Very Much Felix ... It is now ALL WORKING ...
I noticed that I did not use a propoer Date Dimension Table ...
Woudl It be a big ask if I reworked my Date Table and if I come into problem ask you to take a look?
- MFelix3 years ago
Super User
Sure no problem.