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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Pratz203
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
v-lionel-msft
Community Support
Community Support

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
v-lionel-msft
Community Support
Community Support

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

 

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!

az38
Community Champion
Community Champion

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

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

az38
Community Champion
Community Champion

@Pratz203 

what the text of error?


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

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.