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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
RichOB
Post Partisan
Post Partisan

Using variables to get percent

Hi,

 

I've had 9 tenants in my apartments from 2024 to 2025. Using Variables, how can I show that in 2025, 57% (4 out of the 7) of the tenants had been evicted, please?

 

TenantDate_Moved_InEvicted
101/10/2024Yes
201/11/2024Yes
301/02/2025No
402/02/2025Yes
503/02/2025Yes
604/02/2025Yes
705/02/2025Yes
806/02/2025No
907/02/2025No
2 ACCEPTED SOLUTIONS
Shahid12523
Community Champion
Community Champion

EvictionRate2025 =
VAR Tenants2025 =
FILTER(
'Tenants',
YEAR('Tenants'[Date_Moved_In]) = 2025
)
VAR Total2025 = COUNTROWS(Tenants2025)
VAR Evicted2025 =
COUNTROWS(
FILTER(
Tenants2025,
'Tenants'[Evicted] = "Yes"
)
)
RETURN
DIVIDE(Evicted2025, Total2025, 0) * 100


This returns 57.14% as a numeric value. You can wrap it in FORMAT(..., "0.00%") if you want it styled as a percentage.

Shahed Shaikh

View solution in original post

AmiraBedh
Super User
Super User

Hello !

You can use a measure :

 

Eviction % (2025) = 
VAR Tenants2025 =
    CALCULATE(
        DISTINCTCOUNT('Tenants'[Tenant]),
        KEEPFILTERS( YEAR('Tenants'[Date_Moved_In]) = 2025 ),
        REMOVEFILTERS('Tenants'[Evicted])
    )
VAR Evicted2025 =
    CALCULATE(
        DISTINCTCOUNT('Tenants'[Tenant]),
        KEEPFILTERS( YEAR('Tenants'[Date_Moved_In]) = 2025 ),
        'Tenants'[Evicted] = "Yes"
    )
RETURN
    DIVIDE(Evicted2025, Tenants2025)

 

AmiraBedh_0-1756903542851.png

 

 

You will find the solution in the pbix file.


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

View solution in original post

5 REPLIES 5
AmiraBedh
Super User
Super User

 

Put Financial_Year on a slicer or in the visual then use:

 

Eviction % (FY) =
VAR TenantsFY =
CALCULATE(
DISTINCTCOUNT('Tenants'[Tenant]),
REMOVEFILTERS('Tenants'[Evicted]) 
)
VAR EvictedFY =
CALCULATE(
DISTINCTCOUNT('Tenants'[Tenant]),
'Tenants'[Evicted] = "Yes"
)
RETURN
DIVIDE(EvictedFY, TenantsFY)

Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696
AmiraBedh
Super User
Super User

Hello !

You can use a measure :

 

Eviction % (2025) = 
VAR Tenants2025 =
    CALCULATE(
        DISTINCTCOUNT('Tenants'[Tenant]),
        KEEPFILTERS( YEAR('Tenants'[Date_Moved_In]) = 2025 ),
        REMOVEFILTERS('Tenants'[Evicted])
    )
VAR Evicted2025 =
    CALCULATE(
        DISTINCTCOUNT('Tenants'[Tenant]),
        KEEPFILTERS( YEAR('Tenants'[Date_Moved_In]) = 2025 ),
        'Tenants'[Evicted] = "Yes"
    )
RETURN
    DIVIDE(Evicted2025, Tenants2025)

 

AmiraBedh_0-1756903542851.png

 

 

You will find the solution in the pbix file.


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696
Shahid12523
Community Champion
Community Champion

EvictionRate2025 =
VAR Tenants2025 =
FILTER(
'Tenants',
YEAR('Tenants'[Date_Moved_In]) = 2025
)
VAR Total2025 = COUNTROWS(Tenants2025)
VAR Evicted2025 =
COUNTROWS(
FILTER(
Tenants2025,
'Tenants'[Evicted] = "Yes"
)
)
RETURN
DIVIDE(Evicted2025, Total2025, 0) * 100


This returns 57.14% as a numeric value. You can wrap it in FORMAT(..., "0.00%") if you want it styled as a percentage.

Shahed Shaikh

This is amazing, thank you. Sorry to be a pain, but how would I refer to a financial year if there is a column for that instead of the Date_Moved_In? The financial year is April-March, so the FY2025 result would be 66%.

TenantDate_Moved_InEvictedFinancial_Year
101/10/2024YesFY2024
201/11/2024YesFY2024
301/02/2025NoFY2024
402/04/2025YesFY2025
503/04/2025YesFY2025
604/04/2025YesFY2025
705/04/2025YesFY2025
806/04/2025NoFY2025
907/04/2025NoFY2025


Thanks

@RichOB 

you can createa a fy column

 

Fiscal_Year = if (month('Table'[Date_Moved_In])<4,"FY" & year('Table'[Date_Moved_In])-1, "FY" & year('Table'[Date_Moved_In]))
 
then create the measure
Measure = DIVIDE(CALCULATE(COUNTROWS('Table'),'Table'[Evicted]="Yes"),COUNTROWS('Table'))
 
11.png
 
pls see the attachment below

 





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

Proud to be a Super User!




Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors