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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.