Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hello, I have the next table :
| idclient | id | status | next 3 state id |
| id1 | 1 | 1 | 3 |
| id1 | 2 | 2 | 3 |
| id1 | 3 | 3 | 12 |
| id1 | 4 | 18 | 12 |
| id2 | 5 | 1 | 7 |
| id2 | 6 | 2 | 7 |
| id2 | 7 | 3 | |
| id3 | 8 | 1 | 9 |
| id3 | 9 | 3 | |
| id3 | 10 | 2 | 11 |
| id3 | 11 | 3 | |
| id1 | 12 | 3 | |
| id1 | 13 | 1 | |
| id1 | 14 | 18 |
i want to find a formula to give me the next 3 stateid in which i find the next id for idclient where status=3. Thank you
Solved! Go to Solution.
You could create a calculated column like
next 3 state id =
VAR currentClient = 'Table'[idclient]
VAR currentID = 'Table'[ID]
RETURN
SELECTCOLUMNS (
TOPN (
1,
FILTER (
ALL ( 'Table' ),
'Table'[idclient] = currentClient
&& 'Table'[status] = 3
&& 'Table'[id] > currentID
),
'Table'[id], ASC
),
"@val", 'Table'[id]
)
You could create a calculated column like
next 3 state id =
VAR currentClient = 'Table'[idclient]
VAR currentID = 'Table'[ID]
RETURN
SELECTCOLUMNS (
TOPN (
1,
FILTER (
ALL ( 'Table' ),
'Table'[idclient] = currentClient
&& 'Table'[status] = 3
&& 'Table'[id] > currentID
),
'Table'[id], ASC
),
"@val", 'Table'[id]
)
Thank you very much!
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 58 | |
| 45 | |
| 42 | |
| 21 | |
| 18 |
| User | Count |
|---|---|
| 172 | |
| 107 | |
| 92 | |
| 54 | |
| 46 |