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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

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
Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors