Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi,
I need a calculated column that returns the first value from another column that is filtered by two additional columns. In excel I use the IF function. The table is a sample of what I am trying to achieve, the calculated column is "Result".
| ID | Label | Unit | Result |
| 1000 | X1 | 1.5 | 1.5 |
| 1000 | X1 | 1.5 | |
| 1000 | X1 | 1.5 | |
| 1000 | B2 | 2 | 2 |
| 1000 | B2 | 2 | |
| 1000 | C3 | 1.8 | 1.8 |
| 1000 | C3 | 1.8 | |
| 1000 | C3 | 1.8 | |
| 1005 | X1 | 1.9 | 1.9 |
| 1005 | X1 | 1.9 | |
| 1005 | Z1 | 2.1 | 2.1 |
| 1005 | Z1 | 2.1 | |
| 1005 | Z1 | 2.1 | |
| 1005 | Z2 | 3 | 3 |
| 1005 | Z2 | 3 | |
| 1005 | C3 | 1.6 | 1.6 |
| 1008 | C3 | 1.6 | |
| 1008 | C3 | 1.6 | |
| 1008 | X1 | 2 | 2 |
Solved! Go to Solution.
Hi,
I am not sure how your datamodel looks like, but I assume you have another column in the table that indicates which one is the first row in the group, for instance, a date column or an index column.
Please check the below picture and the attached pbix file.
Result CC =
VAR _reference =
CALCULATE (
MAX ( Data[Index] ),
INDEX (
1,
SUMMARIZE ( ALL ( Data ), Data[ID], Data[Label], Data[Unit], Data[Index] ),
ORDERBY ( Data[Index], ASC ),
KEEP,
PARTITIONBY ( Data[ID], Data[Label] )
)
)
RETURN
IF ( Data[Index] = _reference, Data[Unit] )
Hi,
I am not sure how your datamodel looks like, but I assume you have another column in the table that indicates which one is the first row in the group, for instance, a date column or an index column.
Please check the below picture and the attached pbix file.
Result CC =
VAR _reference =
CALCULATE (
MAX ( Data[Index] ),
INDEX (
1,
SUMMARIZE ( ALL ( Data ), Data[ID], Data[Label], Data[Unit], Data[Index] ),
ORDERBY ( Data[Index], ASC ),
KEEP,
PARTITIONBY ( Data[ID], Data[Label] )
)
)
RETURN
IF ( Data[Index] = _reference, Data[Unit] )
Excelent, that worked perfectly. Thanks!
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 5 | |
| 5 | |
| 4 |
| User | Count |
|---|---|
| 25 | |
| 16 | |
| 8 | |
| 7 | |
| 7 |