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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.