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
peterso
Helper II
Helper II

I'm stumped!

Hi all,

 

I'm stumped on what should be a simple exercise, and my attempts have not been successful. Hopefully you folks can help.

I've tried variations of IF statements and Lookups and have had no luck.

 

My goal is to return the value of Column B into Column C if the value in Column A equals to 1/10/2020, otherwise return 0.

 

Capture.PNG

 

The result should look like this:

ccccc.PNG

 

Thank you in advance!

 

1 ACCEPTED SOLUTION

Hi @peterso ,

 

Try using Add Column --> Conditional Column

 

1.jpg

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

View solution in original post

7 REPLIES 7
amitchandak
Super User
Super User

@peterso ,

M

Column C = if [Column A] =Date.FromText("2020-01-01") then [Column B] else 0

Dax
Column C = Switch( True() , [Column A] =Date(2020,1,1) , [Column B], 0)

@amitchandak 

 

Looks like I got an error but everything should be correct. What do you think?

error.PNG

Hi @peterso ,

 

Try using Add Column --> Conditional Column

 

1.jpg

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

@harshnathani  Thanks!

Hi @peterso ,

 

shared the solution at 

 

https://community.powerbi.com/t5/DAX-Commands-and-Tips/This-should-be-simple-right/m-p/1305603#M2267...

 

Let us know if it works.

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

pranit828
Community Champion
Community Champion

Hi @peterso 

 

I would create a new column as below

Column C = IF('Table'[Column A]=DATE(2020,1,10),'Table'[Column B],"0")

 See below the screen shot for a sample example. Here the date is 02/01/2019(MM/DD/YYYY)

pranit828_0-1597798888741.png

 





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile
lbendlin
Super User
Super User

Where do you want to do that, in Power Query or in DAX?

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.