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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

Reply
Anonymous
Not applicable

Textsplit command in Power BI

Hi,

 

I have a list of adresses with the age of the habitants of each adres. I'm trying to create a measure in Power BI to show the average age of each adress. However, as seen below the age  is divided by a comma in a single cell. I don't want to split the cell into multiple rows or colums as some adresses consist of hundreds of habitants and i also have already 70K+ rows.

 

AgeAverage age
2929
22,22,2222
22,21,2121,33333333
22,2021
2828
00
00
32,31,24,2327,5
46,45,12,11,624

 

The formula i used in Excell is the following:

=AVERAGE(VALUE(TEXTSPLIT('Age',",")))

 

I would like to create a measure in Power BI similar to the formula in Excell, which has the output of Average age. What would be a similair formula to achieve the same result?

 

Cheers

1 ACCEPTED SOLUTION
tamerj1
Community Champion
Community Champion

Hi @Anonymous 

please try

Average Age =
VAR String = 'Table'[Age]
VAR Items =
SUBSTITUTE ( String, ",", "|" )
VAR Length =
COALESCE ( PATHLENGTH ( Items ), 1 )
VAR T =
GENERATESERIES ( 1, Length, 1 )
RETURN
AVERAGEX ( SELECTCOLUMNS ( T, "@Item", PATHITEM ( Items, [Value] ) ), [@Item] )

View solution in original post

3 REPLIES 3
tamerj1
Community Champion
Community Champion

Hi @Anonymous 

please try

Average Age =
VAR String = 'Table'[Age]
VAR Items =
SUBSTITUTE ( String, ",", "|" )
VAR Length =
COALESCE ( PATHLENGTH ( Items ), 1 )
VAR T =
GENERATESERIES ( 1, Length, 1 )
RETURN
AVERAGEX ( SELECTCOLUMNS ( T, "@Item", PATHITEM ( Items, [Value] ) ), [@Item] )

Anonymous
Not applicable

Hello @tamerj1,

 

Thank you for your quick response, i occured one problem when putting in the formula. Which is that PowerBI does not recognize my 'Table'[Age] when i try to type it as VAR String =. Currently it is marked as text in PowerBI. What can i do to solve this.

@Anonymous 

The code was intended for a calculated column. If you wish to create a measure you need to use aggregation function like MAX, MIN or SELECTEDVALUE 

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

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.