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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount 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
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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