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
Kansetsuwaza
Frequent Visitor

Tagging each unique ID by using the yearly average

Dear Community,

I have a challenge with some external data that I’d hope the BI query would help me with.

 

I would like to tag the property IDs in an occupancy rate range (i.e. 0%-10%, 10%-20% etc... ).
This tag should be calculated by using the average occupancy rate of each year for each unique ID.

For this reason, this tag may be under different ranges for each year.

 

You may find a sample .pbix HERE

 

Property IDYearOcc Range
ABC1201810%-20%
ABC1201920%-30%
ABC12020

70%-80%

 

Thus, I will be able to see the number of IDs that are taking place under different ranges for each year.

 

Kansetsuwaza_0-1670249946663.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Kansetsuwaza ,

 

Here are the steps you can follow:

1. Create calculated column.

Flag =
SWITCH(
    TRUE(),
    'Test'[Occupancy]>=0&&'Test'[Occupancy]<=0.1,"0%-10%",
    'Test'[Occupancy]>0.1&&'Test'[Occupancy]<=0.2,"10%-20%",
    'Test'[Occupancy]>0.2&&'Test'[Occupancy]<=0.3,"20%-30%",
    'Test'[Occupancy]>0.3&&'Test'[Occupancy]<=0.4,"30%-40%",
    'Test'[Occupancy]>0.4&&'Test'[Occupancy]<=0.5,"40%-50%",
    'Test'[Occupancy]>0.5&&'Test'[Occupancy]<=0.6,"50%-60%",
    'Test'[Occupancy]>0.6&&'Test'[Occupancy]<=0.7,"60%-70%",
    'Test'[Occupancy]>0.7&&'Test'[Occupancy]<=0.8,"70%-80%",
    'Test'[Occupancy]>0.8&&'Test'[Occupancy]<=0.9,"80%-90%",
    'Test'[Occupancy]>0.9&&'Test'[Occupancy]<=1,"90%-100%")
year =
YEAR('Test'[Reporting Month])

vyangliumsft_0-1670312838720.png

2. Create measure.

Measure =
DISTINCTCOUNT('Test'[Property ID])

3. Result:

vyangliumsft_1-1670312838726.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi  @Kansetsuwaza ,

 

Here are the steps you can follow:

1. Create calculated column.

Flag =
SWITCH(
    TRUE(),
    'Test'[Occupancy]>=0&&'Test'[Occupancy]<=0.1,"0%-10%",
    'Test'[Occupancy]>0.1&&'Test'[Occupancy]<=0.2,"10%-20%",
    'Test'[Occupancy]>0.2&&'Test'[Occupancy]<=0.3,"20%-30%",
    'Test'[Occupancy]>0.3&&'Test'[Occupancy]<=0.4,"30%-40%",
    'Test'[Occupancy]>0.4&&'Test'[Occupancy]<=0.5,"40%-50%",
    'Test'[Occupancy]>0.5&&'Test'[Occupancy]<=0.6,"50%-60%",
    'Test'[Occupancy]>0.6&&'Test'[Occupancy]<=0.7,"60%-70%",
    'Test'[Occupancy]>0.7&&'Test'[Occupancy]<=0.8,"70%-80%",
    'Test'[Occupancy]>0.8&&'Test'[Occupancy]<=0.9,"80%-90%",
    'Test'[Occupancy]>0.9&&'Test'[Occupancy]<=1,"90%-100%")
year =
YEAR('Test'[Reporting Month])

vyangliumsft_0-1670312838720.png

2. Create measure.

Measure =
DISTINCTCOUNT('Test'[Property ID])

3. Result:

vyangliumsft_1-1670312838726.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

amitchandak
Super User
Super User

@Kansetsuwaza , You need consider

Dynamic Segmentation Bucketing Binning
https://community.powerbi.com/t5/Quick-Measures-Gallery/Dynamic-Segmentation-Bucketing-Binning/m-p/1...


Dynamic Segmentation, Bucketing or Binning: https://youtu.be/CuczXPj0N-k

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.