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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Udsan77
Regular Visitor

Switch and Counts are not working

Hi Team,

 

i am having the data as below.

Error_MessageValue
NameA
Name, AddressA
AddressA
Name,Address,PhoneA
Address,PhoneA
PhoneA
Name, PhoneA
Name,AddressA
NmaeA

 And expecting the result as

ErrorCount
Name6
Address5
Phone4

 

I tried using Switch case which is not allowing me to count the duplicates which are got satisfied with other names.

ERROR = SWITCH(TRUE(),SEARCH("Phone",'TEST'[ERROR MESSAGE],,0) <> 0,"PHONE_ERROR",SEARCH("Address, Phone",'TEST'[ERROR MESSAGE],,0)<> 0,"ADDRESS_ERROR","NAME_ERROR")

 

COUNT = COUNT('TEST'[VALUE])

 

Please help me in getting the expected results

 

Thanks In Advance

 

Regards,

Udsan77

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

 

Using the Query Editor, right click on the first column > Split column > By delimier.  Specify the delimiter as , and click on Advanced > By rows > Finish/OK.  Now right click on the column > Transform > Trim.  Click on Close and Load.  Now build your visual/create your measure.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Udsan77
Regular Visitor

Hi Team,

 

Can someone help me in resolving the below issue?

 

Thanks in Advance

 

Regards,

Uday Yeluru

Johanno
Continued Contributor
Continued Contributor

Since noone else has replied:

 

If you have a limited amount of error codes and a limited amount per row you could:

1. Use Power Query to separate to columns with comma seperator

2. Create one measure per error code:

Name = CALCULATE(COUNTROWS(Test);Test[Column1.1]="Name") + CALCULATE(COUNTROWS(Test);Test[Column1.2]="Name") + CALCULATE(COUNTROWS(Test);Test[Column1.3]="Name") 
Phone = CALCULATE(COUNTROWS(Test);Test[Column1.1]="Phone") + CALCULATE(COUNTROWS(Test);Test[Column1.2]="Phone") + CALCULATE(COUNTROWS(Test);Test[Column1.3]="Phone") 

etc. 

 

But this is probably not a good looking solution. 

 

Here was a similar question:

https://community.powerbi.com/t5/Desktop/String-Text-search-for-keywords-in-multiple-columns/td-p/41...

Thanks Johanno.

 

I am not able to achive the expected result with this solution.

 

I tried spliting the column based on delimiter comma by rows and use the Switich and Count its working.

 

Regards,

Udsan

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors