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 All,
I am trying to add a table column to end up with the column called group below.
Could anyone help please
| Primary Key | Mark date | Present | Days | Group |
| 1 | 9/3/2024 | 2 | 1 | 9/17/2024 |
| 1 | 9/4/2024 | 2 | 1 | 9/17/2024 |
| 1 | 9/5/2024 | 2 | 1 | 9/17/2024 |
| 1 | 9/6/2024 | 2 | 1 | 9/17/2024 |
| 1 | 9/9/2024 | 2 | 1 | 9/17/2024 |
| 1 | 9/10/2024 | 2 | 1 | 9/17/2024 |
| 1 | 9/11/2024 | 2 | 1 | 9/17/2024 |
| 1 | 9/12/2024 | 2 | 1 | 9/17/2024 |
| 1 | 9/13/2024 | 2 | 1 | 9/17/2024 |
| 1 | 9/16/2024 | 2 | 1 | 9/17/2024 |
| 1 | 9/17/2024 | 2 | 1 | 9/17/2024 |
| 1 | 9/18/2024 | 0 | ||
| 1 | 9/19/2024 | 0 | ||
| 1 | 9/20/2024 | 0 | ||
| 1 | 9/23/2024 | 2 | 1 | 9/23/2024 |
| 1 | 9/24/2024 | 0 | ||
| 1 | 9/26/2024 | 2 | 1 | 9/27/2024 |
| 1 | 9/27/2024 | 2 | 1 | 9/27/2024 |
| 1 | 9/30/2024 | 0 | ||
| 1 | 10/1/2024 | 2 | 1 | 10/3/2024 |
| 1 | 10/2/2024 | 2 | 1 | 10/3/2024 |
| 1 | 10/3/2024 | 2 | 1 | 10/3/2024 |
| 1 | 10/4/2024 | 0 | ||
| 1 | 10/7/2024 | 2 | 1 | 10/7/2024 |
| 1 | 10/8/2024 | 0 | ||
| 1 | 10/9/2024 | 2 | 1 | 10/10/2024 |
| 1 | 10/10/2024 | 2 | 1 | 10/10/2024 |
Many thanks
Solved! Go to Solution.
Group =
IF(
DATA[Present] = 2,
VAR __dt = DATA[Mark date]
VAR __gap =
CALCULATE(
MIN( DATA[Mark date] ),
ALLEXCEPT( DATA, DATA[Primary Key] ),
DATA[Present] = 0,
DATA[Mark date] > __dt
)
RETURN
IF(
ISBLANK( __gap ),
CALCULATE( MAX( DATA[Mark date] ), ALLEXCEPT( DATA, DATA[Primary Key] ) ),
CALCULATE(
MAX( DATA[Mark date] ),
ALLEXCEPT( DATA, DATA[Primary Key] ),
DATA[Present] = 2,
DATA[Mark date] < __gap
)
)
)
Expertise = List.Accumulate( {Days as from Today}, {Skills and Knowledge}, (Current, Everyday) => Current & Day.LearnAndPractise(Everyday) ) |
Group =
IF(
DATA[Present] = 2,
VAR __dt = DATA[Mark date]
VAR __gap =
CALCULATE(
MIN( DATA[Mark date] ),
ALLEXCEPT( DATA, DATA[Primary Key] ),
DATA[Present] = 0,
DATA[Mark date] > __dt
)
RETURN
IF(
ISBLANK( __gap ),
CALCULATE( MAX( DATA[Mark date] ), ALLEXCEPT( DATA, DATA[Primary Key] ) ),
CALCULATE(
MAX( DATA[Mark date] ),
ALLEXCEPT( DATA, DATA[Primary Key] ),
DATA[Present] = 2,
DATA[Mark date] < __gap
)
)
)
Expertise = List.Accumulate( {Days as from Today}, {Skills and Knowledge}, (Current, Everyday) => Current & Day.LearnAndPractise(Everyday) ) |
Hi @CEllis ,
You can achieve this in Power Query by using the Fill Down feature. Here's how:
This will fill the Group column with the reference dates for each continuous streak where Present = 2.
Best regards,
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.