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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.