cancel
Showing results for
Did you mean:
Highlighted
Helper I

## Need help in formulating a column

Hello Experts,
I am new to powerbi and would appreciate your help.
I have a sample data as below:

 ID Date 1 15-09-19 1 20-10-19 2 10-08-19 2 23-11-19 3 29-11-19 3 15-12-19 3 07-01-20

Expectation: I want to add a column which would contain only True or False values based on the below logic
For a given ID, the row with max date should display True else False

The expected table should look like:

 ID Date T/F 1 15-09-19 F 1 20-10-19 T 2 10-08-19 F 2 23-11-19 T 3 29-11-19 F 3 15-12-19 F 3 07-01-20 T

Looking forward to response.
Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support

## Re: Need help in formulating a column

Hi @Pratz203 ,

The formula @az38  created is a measure.

If you want a calculated column, you can do like this:

``````Column =
VAR x =
CALCULATE(
MAX([Date]),
ALLEXCEPT(
Sheet1,
Sheet1[ID]
)
)
RETURN
IF(
[Date] = x,
"T", "F"
)``````

6 REPLIES 6
Highlighted
Super User II

## Re: Need help in formulating a column

try a measure

``````Measure =
var _maxDate = CALCULATE(MAX(Table[Date]), ALLEXCEPT(Table, Table[ID]))
RETURN
IF(SELECTEDVALUE(Table[Date]) = _maxDate, TRUE(), FALSE() )``````

do not hesitate to give a kudo to useful posts and mark solutions as solution

Highlighted
Helper I

## Re: Need help in formulating a column

Thanks @az38 for the quick response but the below command is giving me an error after RETURN

Highlighted
Helper I

## Re: Need help formulating a column

Thank you @az38 for the quick response, but the following command is giving me an error after RETURN

Highlighted
Super User II

## Re: Need help formulating a column

what the text of error?

do not hesitate to give a kudo to useful posts and mark solutions as solution

Highlighted
Community Support

## Re: Need help in formulating a column

Hi @Pratz203 ,

The formula @az38  created is a measure.

If you want a calculated column, you can do like this:

``````Column =
VAR x =
CALCULATE(
MAX([Date]),
ALLEXCEPT(
Sheet1,
Sheet1[ID]
)
)
RETURN
IF(
[Date] = x,
"T", "F"
)``````

Highlighted
Helper I

## Re: Need help in formulating a column

Thanks a lot to you both @v-lionel-msft  and @az38  for your help and replies.
Feel happy to be part of this community.
Keep up the good work guys!

Announcements

#### August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

#### Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

#### Upcoming Events

Wondering what events you could join or have an event to promote yourself? Check out our Upcoming Events.

#### Get Ready for Power BI Dev Camp

We are thrilled to announce we will begin running a monthly webinar series named Power BI Dev Camp.

Top Solution Authors
Top Kudoed Authors