The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
I was wondering is there a function that could calculate number of occurences within one row?
For example, i want to calculate the number of times word "red" occures within a row.
Result would look something like this:
Color | Red | Blue
------------------------------------
Red, Blue, Red | 2 | 1
------------------------------------
Red, Red, Red | 3 | 0
Thanks
Hi @IvanMislav ,
The following DAX might work for you:
Red = var a=ADDCOLUMNS(GENERATESERIES(1,PATHLENGTH(max(Table1[Column]))),"Item",PATHITEM(MAX(Table1[Column]),[Value]))
return COUNTROWS(FILTER(a,[Item]="red"))
blue = var a=ADDCOLUMNS(GENERATESERIES(1,PATHLENGTH(max(Table1[Column]))),"Item",PATHITEM(MAX(Table1[Column]),[Value]))
return COUNTROWS(FILTER(a,[Item]="blue"))+0
The final output is shown in the following figure:
Best Regards,
Xianda Tang
If this post helps , then please consider Accept it as the solution to help the other members find it more quickly.
User | Count |
---|---|
15 | |
13 | |
8 | |
6 | |
6 |
User | Count |
---|---|
27 | |
19 | |
13 | |
9 | |
5 |