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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric 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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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