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 would like to create a column (RESULT) with the condition that if the category is repeated sequentially (ID) it returns the first ID.
For example:
Solved! Go to Solution.
Hi,
Thank you for your clarification.
Please check the below picture and the attached pbix file.
Result First ID CC =
VAR _currentid = Data[ID]
VAR _condition =
ADDCOLUMNS (
Data,
"@condition",
VAR _currentid = Data[ID]
VAR _currentrow = Data[Category]
VAR _prevrow =
MAXX (
OFFSET ( -1, Data, ORDERBY ( Data[ID], ASC ),,, MATCHBY ( Data[ID] ) ),
Data[Category]
)
RETURN
IF ( _currentrow = _prevrow || BLANK (), 0, 1 )
)
VAR _partition =
ADDCOLUMNS (
_condition,
"@partition", SUMX ( FILTER ( _condition, Data[ID] <= EARLIER ( Data[ID] ) ), [@condition] )
)
VAR _currentpartition =
MINX ( FILTER ( _partition, Data[ID] = _currentid ), [@partition] )
RETURN
MINX ( FILTER ( _partition, [@partition] = _currentpartition ), Data[ID] )
Hi,
Please check the below picture and the attached pbix file.
It is for creating a new column.
Result First ID CC =
MINX ( FILTER ( Data, Data[Category] = EARLIER ( Data[Category] ) ), Data[ID] )
Hi,
Thank you for your clarification.
Please check the below picture and the attached pbix file.
Result First ID CC =
VAR _currentid = Data[ID]
VAR _condition =
ADDCOLUMNS (
Data,
"@condition",
VAR _currentid = Data[ID]
VAR _currentrow = Data[Category]
VAR _prevrow =
MAXX (
OFFSET ( -1, Data, ORDERBY ( Data[ID], ASC ),,, MATCHBY ( Data[ID] ) ),
Data[Category]
)
RETURN
IF ( _currentrow = _prevrow || BLANK (), 0, 1 )
)
VAR _partition =
ADDCOLUMNS (
_condition,
"@partition", SUMX ( FILTER ( _condition, Data[ID] <= EARLIER ( Data[ID] ) ), [@condition] )
)
VAR _currentpartition =
MINX ( FILTER ( _partition, Data[ID] = _currentid ), [@partition] )
RETURN
MINX ( FILTER ( _partition, [@partition] = _currentpartition ), Data[ID] )
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 |