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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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