Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.
Hi
I have a Column with Chemical element symbols separated by ";" in each cell, eg [ H;O;Pb;Ti]
There are between 1 - 16 symbols in each cell from a list of 78 valid elements in another table. 
I want to create a count of these in a new column. Where the values are validated against the list of 78 elements and then counted in the column.
I have written the expression 
Solved! Go to Solution.
Here's how I would count with validation using PATHCONTAINS:
ValidatedCount =
VAR CurrPath = SUBSTITUTE ( MineralInfo[ElementList], ";", "|" )
RETURN
    COUNTROWS (
        FILTER (
			PeriodicTable,
			PATHCONTAINS ( CurrPath, PeriodicTable[Element] )
		)
    )
Here's how I would count with validation using PATHCONTAINS:
ValidatedCount =
VAR CurrPath = SUBSTITUTE ( MineralInfo[ElementList], ";", "|" )
RETURN
    COUNTROWS (
        FILTER (
			PeriodicTable,
			PATHCONTAINS ( CurrPath, PeriodicTable[Element] )
		)
    )
Thanks also - this solution works perfectly and also makes a better solution, and I can re-use the logic in other conversions - Brilliant!!!
Bigglerum
Hi thanks for you fast reply
the first solution is the same as my original query and the second doesn't seem to fire.
If this helps anyone - I went for a less elegant solution but it works
=LEN(TRIM(Cell))-LEN(SUBSTITUTE(TRIM(Cell),";",""))+1
ie it works out on the ";" separator and adds 1 to the total
@Bigglerum , if these tables are connected correctly then one of these two should work
SUMX(
VALUES('104 Periodic Table Filter'[Element]),
CALCULATE(COUNT('201 Mineral Information'[Elements])) )
SUMX(
Summarize('104 Periodic Table Filter','104 Periodic Table Filter'[Element], "_1",
CALCULATE(COUNT('201 Mineral Information'[Elements])) ), [_1])
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
