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
aishaakhter18
Helper I
Helper I

Need to help in Counting countries separated by commas excluding empty row

aishaakhter18_0-1692640525066.png

Hi I am trying to create a calculation for the col above, first i tried below option

 Option 1
Countires Count updated = LEN('PID & HVT Metrics Tracker'[3 Col Countries]) - LEN(SUBSTITUTE('PID & HVT Metrics Tracker'[3 Col Countries],",",""))+1
 
Then use this option in power query 
+List.NonNullCount(Text.Split([3 Col Countries],","))
 
but both are giving me same result and count the the empty row too as you can see in the attached screen, how should i fix it?
Thanks
1 ACCEPTED SOLUTION

@aishaakhter18 

Please try

Countires Count =
PATHLENGTH (
SUBSTITUTE (
IF (
'PID & HVT Metrics Tracker'[3 Col Countries] = "",
BLANK (),
'PID & HVT Metrics Tracker'[3 Col Countries]
),
",",
"|"
)
)

View solution in original post

5 REPLIES 5
aishaakhter18
Helper I
Helper I

Thanks it worked, greatly appreciated 

aishaakhter18
Helper I
Helper I

Thanks alot , it worked 

tamerj1
Super User
Super User

Hi @aishaakhter18 

please try

Countires Count =
PATHLENGTH (
SUBSTITUTE ( 'PID & HVT Metrics Tracker'[3 Col Countries], ",", "|" )
)

Thanks for getting back but still counting the empty row, 😞

@aishaakhter18 

Please try

Countires Count =
PATHLENGTH (
SUBSTITUTE (
IF (
'PID & HVT Metrics Tracker'[3 Col Countries] = "",
BLANK (),
'PID & HVT Metrics Tracker'[3 Col Countries]
),
",",
"|"
)
)

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.