cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
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:

IDDate
115-09-19
120-10-19
210-08-19
223-11-19
329-11-19
315-12-19
307-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:

IDDateT/F
115-09-19F
120-10-19T
210-08-19F
223-11-19T
329-11-19F
315-12-19F
307-01-20T


Looking forward to response.
Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Need help in formulating a column

Hi @Pratz203 ,

 

The formula @az38  created is a measure.

eee6.PNG

 

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

eee4.PNG

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

 eee5.PNG

 

View solution in original post

6 REPLIES 6
Highlighted
Super User II
Super User II

Re: Need help in formulating a column

Hi @Pratz203 

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
LinkedIn

Highlighted
Helper I
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
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
Super User II

Re: Need help formulating a column

@Pratz203 

what the text of error?


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

Highlighted
Community Support
Community Support

Re: Need help in formulating a column

Hi @Pratz203 ,

 

The formula @az38  created is a measure.

eee6.PNG

 

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

eee4.PNG

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

 eee5.PNG

 

View solution in original post

Highlighted
Helper I
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!

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

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

Community Blog

Community Blog

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

Upcoming Events

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

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