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.
Hi All,
I have searched for a solution to this question but have had no luck so far.
I would like to calculate the number of string occurences in all rows of a certain column, based on a string in the current row of a seperate column. For example:
BOM |
COMPONENT2,COMPONENT3,COMPONENT3 |
COMPONENT1,COMPONENT5,COMPONENT3 |
COMPONENT2,COMPONENT1 |
COMPONENT1,COMPONENT3 |
COMPONENT1,COMPOMENT2,COMPONENET3,COMPONENT4 |
SKU | SKU in BOM |
COMPONENT 1 | 4 |
COMPONENT 2 | 3 |
COMPONENT 3 | 5 |
COMPONENT 4 | 1 |
COMPONENT 5 | 1 |
Currently, I can count the rows where the string occurs using DAX:
SKU in BOM = countrows(filter('Data',find(earlier('Data'[SKU]),'Data'[BOM],,0)>0))
But this gives just a count of the rows, wheras I want to get the total number of occurances.
I have seen a suggestion of using Text.Split to get the number of occurences, but I'm not sure how to reference the "SKU" Column as the delimiter and how to iterate over every row and sum, rather than just the current row.
Edit: The main issue I have is that each component can be present more than once in any given row. Editted the tables to clarify.
Any help would be appreciated.
Solved! Go to Solution.
I personally duplicate the table and I open the query Editor to split the data into rows
Then I can apply the DAX formula proposed by @Zubair_Muhammad
Then you can use this table in a visual rapidly.
I know it is only to save you because a DAX formula should solve it but I don't know it !
Regards,
CR
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
94 | |
82 | |
66 | |
59 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |