Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi,
I am developing a report in PowerBI Desktop.
When a value in the column ID is shown multiple times I want the last column to contain a '1' for the row with the highest enddate.
ID | Startdate | Enddate | Column value |
1 | 1-5-2018 | 31-12-2019 | 0 |
2 | 1-1-2024 | 31-12-2024 | 1 |
2 | 1-1-2023 | 31-12-2023 | 0 |
3 | 1-1-2024 | 0 |
Been struggling with all kinds of formula's but haven't been able to find a solution.
Solved! Go to Solution.
Hi @Minkee,
You can try such a calculated column:
DAX code in plain text for convenience:
Flag =
VAR currentID = [ID]
VAR _tbl = FILTER ( Data, [ID] = currentID )
VAR maxDate = IF ( COUNTROWS ( _tbl ) > 1, MAXX ( _tbl, [Enddate] ) )
RETURN IF ( [Enddate] = maxDate && COUNTROWS ( _tbl ) > 1, 1, 0 )
Best Regards,
Alexander
Hi @Minkee,
You can try such a calculated column:
DAX code in plain text for convenience:
Flag =
VAR currentID = [ID]
VAR _tbl = FILTER ( Data, [ID] = currentID )
VAR maxDate = IF ( COUNTROWS ( _tbl ) > 1, MAXX ( _tbl, [Enddate] ) )
RETURN IF ( [Enddate] = maxDate && COUNTROWS ( _tbl ) > 1, 1, 0 )
Best Regards,
Alexander
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
124 | |
79 | |
50 | |
38 | |
38 |
User | Count |
---|---|
195 | |
80 | |
70 | |
51 | |
42 |