Forum Discussion
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
Hi Anonymous ,
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
- v-lionel-msftCommunity Support
Hi Anonymous ,
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" )- AnonymousNot applicable
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!
- az38Community Champion
Hi Anonymous
try a measure
Measure = var _maxDate = CALCULATE(MAX(Table[Date]), ALLEXCEPT(Table, Table[ID])) RETURN IF(SELECTEDVALUE(Table[Date]) = _maxDate, TRUE(), FALSE() )