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
I have a scenario where I need to get summary of values till it encounters zero and reset the summary to zero once it has the zero value.
Solved! Go to Solution.
Hi @Anonymous ,
Here are the steps you can follow:
1.Create calculated column.
Column1 =
IF(
'Table'[YELLOW]=0,1,0)Column2 =
SUMX(
FILTER(ALL('Table'),
'Table'[FW_ID]<=EARLIER('Table'[FW_ID])),[Column1])
2. Create measure.
Test1 =
IF(
MAX('Table'[Column1])=1,BLANK(),
COUNTX(
FILTER(ALLSELECTED('Table'),
'Table'[Column2]=MAX('Table'[Column2])&&[Column1]<>1),[FW_ID]))Test2 =
SUMX(
FILTER(ALL('Table'),[Test1]>1),[YELLOW])
3. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi,
I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.
It is for cumulative sum grouped by non-consecutive-zero.
expected result measure: =
VAR _yellow =
ADDCOLUMNS ( ALL ( data ), "@yellow", [yellow:] )
VAR _condition =
ADDCOLUMNS ( _yellow, "@condition", IF ( [@yellow] = 0, 1, 0 ) )
VAR _group =
ADDCOLUMNS (
_condition,
"@group",
SUMX (
FILTER ( _condition, data[fw_id] <= EARLIER ( data[fw_id] ) ),
[@condition]
)
)
VAR _currentrowgroup =
MAXX ( FILTER ( _group, data[fw_id] = MAX ( data[fw_id] ) ), [@group] )
RETURN
SUMX (
FILTER (
_group,
[@group] = _currentrowgroup
&& data[fw_id] <= MAX ( data[fw_id] )
),
[@yellow]
)
Hi,
I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.
It is for cumulative sum grouped by non-consecutive-zero.
expected result measure: =
VAR _yellow =
ADDCOLUMNS ( ALL ( data ), "@yellow", [yellow:] )
VAR _condition =
ADDCOLUMNS ( _yellow, "@condition", IF ( [@yellow] = 0, 1, 0 ) )
VAR _group =
ADDCOLUMNS (
_condition,
"@group",
SUMX (
FILTER ( _condition, data[fw_id] <= EARLIER ( data[fw_id] ) ),
[@condition]
)
)
VAR _currentrowgroup =
MAXX ( FILTER ( _group, data[fw_id] = MAX ( data[fw_id] ) ), [@group] )
RETURN
SUMX (
FILTER (
_group,
[@group] = _currentrowgroup
&& data[fw_id] <= MAX ( data[fw_id] )
),
[@yellow]
)
Hi @Anonymous ,
Here are the steps you can follow:
1.Create calculated column.
Column1 =
IF(
'Table'[YELLOW]=0,1,0)Column2 =
SUMX(
FILTER(ALL('Table'),
'Table'[FW_ID]<=EARLIER('Table'[FW_ID])),[Column1])
2. Create measure.
Test1 =
IF(
MAX('Table'[Column1])=1,BLANK(),
COUNTX(
FILTER(ALLSELECTED('Table'),
'Table'[Column2]=MAX('Table'[Column2])&&[Column1]<>1),[FW_ID]))Test2 =
SUMX(
FILTER(ALL('Table'),[Test1]>1),[YELLOW])
3. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
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 |