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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
samoberoi
Helper II
Helper II

Wrong values coming in location B rather than chosen in location A through Conditional column functi

Hi,

 

I try to create a conditional column in which i choose e.g -

IF "READ" CONTAINS "A" THEN "HILL"

IF "READ" CONTAINS "B" THEN "HILL" 

IF "READ" CONTAINS "C" THEN "HILL" 

IF "READ" CONTAINS "D" THEN "HILL" 

 

ELSE "DAR"

 

Most of the values are showing right when i put those in filter, but there are a few values showing up in "DAR" rather than in "HILL", which otherwise should show up in "HILL" as chosen.

Help will be appreciated.

Thanks

1 ACCEPTED SOLUTION

Hi @samoberoi ,

 

You can create a custom column in Power Query Editor by below code.

if 
List.Contains( {"A","B","C","D"},[READ]) 
then 
"Hill" 
else if
List.Contains( {"E","F","G","H"},[READ])
then
"DAR"
else
"COB"

Result is as below.

RicoZhou_0-1671009268238.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

4 REPLIES 4
TomMartens
Super User
Super User

Hey @samoberoi ,

 

please provide sample data and the exact formula, I have to admit that I'm not able to determine if you are trying to create the column using DAX or Power Query's M.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

The main objective is to put the locations in a column in 4 buckets. e.g:- A,B,C,D should go to HILL;  E,F,G,H should go in the bucket DAR; I,J,K should go to bucket COB and so on.

Hi @samoberoi ,

 

You can create a custom column in Power Query Editor by below code.

if 
List.Contains( {"A","B","C","D"},[READ]) 
then 
"Hill" 
else if
List.Contains( {"E","F","G","H"},[READ])
then
"DAR"
else
"COB"

Result is as below.

RicoZhou_0-1671009268238.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Hi
It is just a simple conditional column i try to create in Power Query. 
Hope that makes it more clear.

Thank you

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.