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

Creating a new range column in Power Query

Hi,
 
I'm currently working with some survey data in Power BI and struggling to creating a new range column based on two other columns. The collection of age data has changed at some point through the years from exact age to an age range and is not aligned (some rows has exact age, some has age range, some has both and some neither). I'm therefore interested in aligning and unifying the age data in a new column similar to the age range column. I've created min value and max value columns to hopefully do this in a sorta 'lookup'-type fashion. 
 
So, its the yellow column [New Age] I would like to create and to be dynamic if other ranges were to be added later - with logic somewhat like this:
if [nyaldgrp] > 0 then [nyaldgrp]
else if [alder] >= [Min_Value] and <= [Max_Value] then [Age_BK]
 
tables.PNG
 
 
 
 
 
 
 
I hope you'll able to help
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous 

 

Your Age Dimension table has all the unique entries, right? Here is one way, added one row to show the result

 

Vera_33_1-1626237241452.png

 

 

(x)=> if x[nyaldrp]>0 then x[alder]
else dimAge[Age_BK]{ List.PositionOf(dimAge[Custom],List.Select(dimAge[Custom], each List.Contains(_,x[alder])){0})}?

 

Added one Custom column in dimAge 

Vera_33_2-1626237309947.png

 

 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @Anonymous 

 

Your Age Dimension table has all the unique entries, right? Here is one way, added one row to show the result

 

Vera_33_1-1626237241452.png

 

 

(x)=> if x[nyaldrp]>0 then x[alder]
else dimAge[Age_BK]{ List.PositionOf(dimAge[Custom],List.Select(dimAge[Custom], each List.Contains(_,x[alder])){0})}?

 

Added one Custom column in dimAge 

Vera_33_2-1626237309947.png

 

 

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.