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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

Aggregating measure that depends on SELECTEDVALUE

Hi,

 

I have created a measure called "Tenure Measure" 

 

Tenure Measure =
IF (
ROUNDUP(SELECTEDVALUE(selected[Year])-MIN(data[First Yr of Service]),0) < 4,
"0-3",
IF (
ROUNDUP(SELECTEDVALUE(selected[Year])-MIN(data[First Yr of Service]),0) > 3 && ROUNDUP(SELECTEDVALUE(selected[Year])-MIN(data[First Yr of Service]),0) < 7,
"4-6",
IF ( ROUNDUP(SELECTEDVALUE(selected[Year])-MIN(data[First Yr of Service]),0) >= 7 && ROUNDUP(SELECTEDVALUE(selected[Year])-MIN(data[First Yr of Service]),0) < 11, "7-10", ">10" )
)
)

 

It works out the tenure of the employee by calculating the difference between year of hire and selected year from the slicer. And next it categorizes the tenure value into 1 of the 4 ranges: 0-3, 4-6, 6-10, >10

 

How do I show a bar chart with 4 bars (1 bar for each range) for the number of employees that are in each tenure range?

 

learner4eva_0-1611214892417.png

 

 

1 ACCEPTED SOLUTION

@Anonymous , bucketing on measure. For this you need an independent table.  ANd you have to create an independent table and use that for creating additional measure which can give the count

 

refer my video - https://www.youtube.com/watch?v=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

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@Anonymous , Please check current Age measure and Age page in the file attached after signature

 

Refer to my blog, how it has been created

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970

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
Anonymous
Not applicable

Hi Amit, thanks for the fast response as always.

I am able to calculate the Tenure measure, but I am struggling to convert the Tenure measure as a column.

Example:

I can see the tenure for each employee when i list the employee id (similar to the matrix visualization you have provided in current_employee.pbix, which has employee id as the 1st column), but i am interested in converting the "tenure measure" (which is expressed as a range 0-3, 4-6, 7-10, >10) into a bar chart. 

learner4eva_0-1611217001976.png

learner4eva_2-1611218452894.png

 

Hoping to get something like this, which I have illustrated in excel. 

Can you advise?

 

@Anonymous , bucketing on measure. For this you need an independent table.  ANd you have to create an independent table and use that for creating additional measure which can give the count

 

refer my video - https://www.youtube.com/watch?v=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
Anonymous
Not applicable

thank you very much! This works!!!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 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.