Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi all
I am trying to make a new column that count the number of occurences contained in another columns strings
My data looks like this (the desired result is marked in yellow)
Thanks in advance
The Best Carsten
Solved! Go to Solution.
Hi,
Please check the below picture and the attached pbix file.
expected result CC =
VAR _maxnumber =
MAXX (
ADDCOLUMNS (
Data,
"@countdelimiter", LEN ( Data[Path] ) - LEN ( SUBSTITUTE ( Data[Path], "|", "" ) )
),
[@countdelimiter]
) + 1
VAR _generateseriestable =
SELECTCOLUMNS ( GENERATESERIES ( 1, _maxnumber, 1 ), "@number", [Value] )
VAR _t =
GENERATE (
_generateseriestable,
ADDCOLUMNS ( Data, "@item", PATHITEM ( Data[Path], [@number] ) )
)
RETURN
COUNTROWS ( FILTER ( _t, [@item] = EARLIER ( Data[ItemID] ) ) )
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Thanks 🙂
Hi,
Please check the below picture and the attached pbix file.
expected result CC =
VAR _maxnumber =
MAXX (
ADDCOLUMNS (
Data,
"@countdelimiter", LEN ( Data[Path] ) - LEN ( SUBSTITUTE ( Data[Path], "|", "" ) )
),
[@countdelimiter]
) + 1
VAR _generateseriestable =
SELECTCOLUMNS ( GENERATESERIES ( 1, _maxnumber, 1 ), "@number", [Value] )
VAR _t =
GENERATE (
_generateseriestable,
ADDCOLUMNS ( Data, "@item", PATHITEM ( Data[Path], [@number] ) )
)
RETURN
COUNTROWS ( FILTER ( _t, [@item] = EARLIER ( Data[ItemID] ) ) )
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
25 | |
20 | |
20 | |
14 | |
13 |
User | Count |
---|---|
43 | |
37 | |
25 | |
24 | |
22 |