Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

sum value over slice

Hi community,


I need calculate a measure with sum the column "Value" over the date filtered, if the Flag = B. I will use this measure in a table vision. For exemplify, I will use this datas:

 

DateFlagItemGroupSubgroupValue
jan/20A0001GROUP1SG110
jan/20A0002GROUP1SG120
jan/20B0001GROUP1SG115
jan/20B0002GROUP1SG122
feb/20A0001GROUP1SG118
feb/20B0002GROUP1SG113
feb/20B0001GROUP1SG130
mar/20A0001GROUP1SG130
mar/20A0002GROUP1SG121
mar/20B0001GROUP1SG119

 


If I filter in slice the dates jan/20 and feb/20, I need the result bellow in the table visual:

DateFlagItemGroupSubgroupValueNewValue
jan/20A0001GROUP1SG11080
jan/20A0002GROUP1SG12080
jan/20B0001GROUP1SG11580
jan/20B0002GROUP1SG12280
feb/20A0001GROUP1SG11880
feb/20B0002GROUP1SG11380
feb/20B0001GROUP1SG13080

 

Just explaining, the value is 80 because the lines with flag B in this filtered period has the values: 15 + 22 + 13 + 30. If I filter jan/20 to mar/20 the new value will be 99 and the lines of mar/20 must appear in table.

 

Anyone help me in this case?

Tks!! 🙂

2 REPLIES 2
mahoneypat
Microsoft Employee
Microsoft Employee

Please try this measure expression

 

Total B Flags =
CALCULATE (
SUM ( 'Table'[Value] ),
ALLSELECTED ( 'Table' ),
'Table'[Flag] = "B"
)

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


lbendlin
Super User
Super User

something like this:

 

var f = selectedvalue(flag)

return calculate (sum(value),filter(allselected(),f="B"))

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.