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
Anonymous
Not applicable

Calculate total of subgroup

Hi,

 

I have raw data with below format. Each station and each date can have a multiple parameter name but the Total Qty will be the same as it it a qty of testing unit on that station / day. 

 

yaneedolruedej_0-1666727923891.png

 

I want to create total of each station  (Total(Station)). And it works.

yaneedolruedej_1-1666728025020.png

 

However, if I put some filter and start using date slicer, the calculation is wrong.

 

yaneedolruedej_2-1666728085898.png ==> filter to station 1&2 only : Still get correct Total Station

 

After adjust date slicer, the Total Station is wrong

 

yaneedolruedej_3-1666728135496.png

 

here are all the calculation

 

yaneedolruedej_0-1666728312054.png

 

yaneedolruedej_1-1666728321774.png

 

yaneedolruedej_2-1666728334627.png

 

How can I fix this?

 

 

 

1 ACCEPTED SOLUTION
raimon
Resolver II
Resolver II

Hi @Anonymous, 

 

Create 2 measures as below, both measures are working with changes in date and station slicer. 

Station Total =
CALCULATE(SUM(sample1[Total Qty]),filter(ALLSELECTED(sample1),sample1[Station]=MAX(sample1[Station])))
 
Grand Total = CALCULATE(SUM(sample1[Total Qty]),ALLSELECTED(sample1))
 
raimon_0-1666768027725.pngraimon_1-1666768069461.png

 

View solution in original post

4 REPLIES 4
raimon
Resolver II
Resolver II

Hi @Anonymous, 

 

Create 2 measures as below, both measures are working with changes in date and station slicer. 

Station Total =
CALCULATE(SUM(sample1[Total Qty]),filter(ALLSELECTED(sample1),sample1[Station]=MAX(sample1[Station])))
 
Grand Total = CALCULATE(SUM(sample1[Total Qty]),ALLSELECTED(sample1))
 
raimon_0-1666768027725.pngraimon_1-1666768069461.png

 

Anonymous
Not applicable

I change the formula a bit to

Station Total = CALCULATE([Total Test],FILTER(ALLSELECTED(sample1),sample1[Station] = MAX(sample1[Station])))
 
Using total qty will be double count but this works.
Can you explain me a bit more on the sample1[Station] = Max(sample1[Station]) ? What does this mena ?
Anonymous
Not applicable

That doesn't work. By using "ALL" function, it doesn't take the date fitler into account.

Shaurya
Memorable Member
Memorable Member

Hi @Anonymous,

 

For Grand Total use:

 

Grand Total = CALCULATE([Total Test], ALL('Sample1'))

 

Works for you? Mark this post as a solution if it does!
Consider taking a look at my blog: Forecast Period - Previous Forecasts

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.

Top Solution Authors