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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
zhejun728
New Member

Sum based on Active Filters

I'm a user of Tableau but a totally new user of Power BI.

Im trying to create a new column to show the sum of COST which can be affected by active filters on visual.

I have a sample data as below.

itemITEM GROUPCOST
SEATCOVERVICTRON9
WASHERGCMSB0.5
NUTGCMSB1
COLLARCW5
SHAFTGCMSB7
COVERBL10

 

 

My expected outcome in Power BI whgen no active filters applied.

itemITEM GROUPCOSTTotal Cost
SEATCOVERVICTRON932.5
WASHERGCMSB0.532.5
NUTGCMSB132.5
COLLARCW532.5
SHAFTGCMSB732.5
COVERBL1032.5



When ITEM GROUP is not GCMSB.

itemITEM GROUPCOSTTotal Cost
SEATCOVERVICTRON924
COLLARCW524
COVERBL1024

 

If possible, I wish there is no hard coding in the command line, and can works dynamically with the active filters.
Thanks !!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @zhejun728 ,

I create a table as you mentioned. Also I created a Slicer.

vyilongmsft_0-1725933111099.png

vyilongmsft_1-1725933240539.png

As tamerj1 said, you can create a measure and here is the DAX code.

Total Cost =
CALCULATE ( SUM ( 'Table'[COST] ), ALLSELECTED ( 'Table' ) )

Finally you can get what you want.

vyilongmsft_2-1725933397695.png

vyilongmsft_3-1725933414770.png

 

 

 

Best Regards

Yilong Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @zhejun728 ,

I create a table as you mentioned. Also I created a Slicer.

vyilongmsft_0-1725933111099.png

vyilongmsft_1-1725933240539.png

As tamerj1 said, you can create a measure and here is the DAX code.

Total Cost =
CALCULATE ( SUM ( 'Table'[COST] ), ALLSELECTED ( 'Table' ) )

Finally you can get what you want.

vyilongmsft_2-1725933397695.png

vyilongmsft_3-1725933414770.png

 

 

 

Best Regards

Yilong Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank Yilong ! That's help !!

tamerj1
Super User
Super User

Hi @zhejun728 

please try

Total Cost =
CALCULATE ( [Cost], ALLSELECTED ( ) )

Thanks @tamerj1 😁

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.