cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Blue714 Frequent Visitor
Frequent Visitor

Change value in Cells

This sounds easy, but I can't seem to figure this out.

 

I'm trying to change the values from dates starting with 2018 to True if there is a date or false if there isn't one.

 

It replaces the 2018 but leaves the trailing number still, I tried using the advanced editor but I can't seem to get it working.

 

Does anyone know how to do this for multi columns?

 

Thanks!

 

Powerbi.JPG

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Change value in Cells

Hi @Blue714,

 

We can create calcualted column to work on it.

 

Column = 
VAR _YEAR =
    YEAR ( 'Table1'[date] )
VAR _YEAR1 =
    YEAR ( 'Table1'[date1] )
VAR _YEAR2 =
    YEAR ( 'Table1'[date2] )
RETURN
    IF ( _YEAR = 2018 && _YEAR1 = 2018 && _YEAR2 = 2018, TRUE (), FALSE () )

Capture.PNG

 

For more details, please check the pbix as attached.

 

Regards,

Frank

Community Support Team _ Frank
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

3 REPLIES 3
jthomson New Contributor
New Contributor

Re: Change value in Cells

It might be a lot simpler to pivot/unpivot everything into two columns of fruit and date, then you can just make a new custom column of something like:

 

if Date.Year(date)=2018 then "true" else "false"

 

Then delete the existing date column and reverse the fruit pivoting/unpivoting

Community Support Team
Community Support Team

Re: Change value in Cells

Hi @Blue714,

 

We can create calcualted column to work on it.

 

Column = 
VAR _YEAR =
    YEAR ( 'Table1'[date] )
VAR _YEAR1 =
    YEAR ( 'Table1'[date1] )
VAR _YEAR2 =
    YEAR ( 'Table1'[date2] )
RETURN
    IF ( _YEAR = 2018 && _YEAR1 = 2018 && _YEAR2 = 2018, TRUE (), FALSE () )

Capture.PNG

 

For more details, please check the pbix as attached.

 

Regards,

Frank

Community Support Team _ Frank
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

Blue714 Frequent Visitor
Frequent Visitor

Re: Change value in Cells

I'm still a bit novice with the query, so I took both answers, mainly creating a custom column and using if Date.Year(date)=2018 then "true" else "false".

 

Frank's attachment helped quit a but, as I couldn't figure out how to get to the formula part of it... I'm sure there is a better way, but for my skillset, it works.

 

Thanks both!

Helpful resources

Announcements
Ask Amanda Anything Q&A

Ask Amanda Anything Q&A

Learn the answers to some of the questions asked during the Amanda Triple A event.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 144 members 1,600 guests
Please welcome our newest community members: