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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
amardeepBI
New Member

calculate text column average

Hi 

how we get the average of column which contains only text in Power BI. 



https://1drv.ms/x/s!Ai3rGPgy20kLg-h0HjiktfFWpeDGhQ?e=VyTAzy 

In attached sheet column name "Activities" needs to be calculate the average by Region and country as well 

1 ACCEPTED SOLUTION
v-chenwuz-msft
Community Support
Community Support

Hi @amardeepBI ,

 

You mean only contain text without number?

Maybe you can try the following code to create a new column:

if_contain_text =
VAR _cur =
    LEN( [Activities] )
VAR _s0 =
    SUBSTITUTE( [Activities], "0", "" )
VAR _s1 =
    SUBSTITUTE( _s0, "1", "" )
VAR _s2 =
    SUBSTITUTE( _s1, "2", "" )
VAR _s3 =
    SUBSTITUTE( _s2, "3", "" )
VAR _s4 =
    SUBSTITUTE( _s3, "4", "" )
VAR _s5 =
    SUBSTITUTE( _s4, "5", "" )
VAR _s6 =
    SUBSTITUTE( _s5, "6", "" )
VAR _s7 =
    SUBSTITUTE( _s6, "7", "" )
VAR _s8 =
    SUBSTITUTE( _s7, "8", "" )
VAR _s9 =
    SUBSTITUTE( _s8, "9", "" )
VAR _final =
    LEN( _s9 )
RETURN
    IF( _cur - _final > 0, 0, 1 )

This column is used to determine if it contains only text.

And in the page, you can use a table visual to dispaly the result.(By the way, I have made some changes to Switzeland of the table you provided,so the result is 0.33)

vchenwuzmsft_0-1642649237009.png

Pbix in the end you can refer.

Best Regards

Community Support Team _ chenwu zhu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

View solution in original post

2 REPLIES 2
v-chenwuz-msft
Community Support
Community Support

Hi @amardeepBI ,

 

You mean only contain text without number?

Maybe you can try the following code to create a new column:

if_contain_text =
VAR _cur =
    LEN( [Activities] )
VAR _s0 =
    SUBSTITUTE( [Activities], "0", "" )
VAR _s1 =
    SUBSTITUTE( _s0, "1", "" )
VAR _s2 =
    SUBSTITUTE( _s1, "2", "" )
VAR _s3 =
    SUBSTITUTE( _s2, "3", "" )
VAR _s4 =
    SUBSTITUTE( _s3, "4", "" )
VAR _s5 =
    SUBSTITUTE( _s4, "5", "" )
VAR _s6 =
    SUBSTITUTE( _s5, "6", "" )
VAR _s7 =
    SUBSTITUTE( _s6, "7", "" )
VAR _s8 =
    SUBSTITUTE( _s7, "8", "" )
VAR _s9 =
    SUBSTITUTE( _s8, "9", "" )
VAR _final =
    LEN( _s9 )
RETURN
    IF( _cur - _final > 0, 0, 1 )

This column is used to determine if it contains only text.

And in the page, you can use a table visual to dispaly the result.(By the way, I have made some changes to Switzeland of the table you provided,so the result is 0.33)

vchenwuzmsft_0-1642649237009.png

Pbix in the end you can refer.

Best Regards

Community Support Team _ chenwu zhu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

amitchandak
Super User
Super User

@amardeepBI , Try a measure like

 

averageX(values(table[region]),calculate(countrows(Table)))

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

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors