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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Huguo90
Helper I
Helper I

I whant to add a new colonne on 2 conditions on 3 colonnes

Hello,

I would like to create a column from 2 coditions,
I have 3 columns and AccountId, RecordId_NV and Distribut_NV and I want to create a 3rd column DISTRIBUT_USERS, in which I will put if 1 or 0

I would like to find a formula like this:

If the value which is in AccountId exists in ID_USER then you put 1
in DISTRIBUT_USERS or if the value which is in RecordId_NV= BU1 then put 1 also in DISTRIBUTOR_USERS. If you found both conditions then put 0.

Just for information I have already tested the text.contain and values.equal and I have already tested the conditional column of Power query but it does not work even by adding the column in front.

See illustration image thank you in advance for your help.

 

I try this with conditional column on power query:

= Table.AddColumn(#"Colonnes renommées6", "DISTRIBUT_USERS", each if [AccountId] = [Distribut_NV] then 1 else if [RecordId_NV] = "0127Q000000hQ" then 1 else 0)

 

This part don't work  [AccountId] = [Distribut_NV]  I think they have other way to do that. 

Image 1.PNG

 

1 ACCEPTED SOLUTION
v-cgao-msft
Community Support
Community Support

Hi @Huguo90 ,

Please try:

each if List.Contains(#"Changed Type"[Distribut_NV],[AccountId]) then 1 else if [Recordld_NV] = "0127Q000000hQ" then 1 else 0

vcgaomsft_0-1668064990318.png

List.Contains - PowerQuery M

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

View solution in original post

1 REPLY 1
v-cgao-msft
Community Support
Community Support

Hi @Huguo90 ,

Please try:

each if List.Contains(#"Changed Type"[Distribut_NV],[AccountId]) then 1 else if [Recordld_NV] = "0127Q000000hQ" then 1 else 0

vcgaomsft_0-1668064990318.png

List.Contains - PowerQuery M

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors
Top Kudoed Authors