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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.

Top Solution Authors