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
tsunamisabella
Frequent Visitor

Create a dynamic column subtotal measure

Hello! I want create a measure [Subtotal] to retrieve the column subtotal (subtotal of the selected period) which can be dyanically changed along the selected column dimension [Period]. Note that [Period] is both the column dimension and a filter.

 

I created a measure below, however, in the pivot table, this [Subtotal] returns the grand total, instead of column subtotal per customer segment:

 

Subtotal = CALCULATE(
[a_measure],
ALLEXCEPT(table_name, table_name[Period])
)

 

 

 

[Period]2023-01 2023-02 2023-03  
[Customer]ValueSubtotalValueSubtotalValueSubtotalColumn Subtotal
Segment 11151151153
Segment 22152152156
Segment 33153153159
Segment 441541541512
Segment 551551551515

 

My goal it to have:

(1)  the measure summarize the column subtotal at each row dimension

[Period]2023-01 2023-02 2023-03  
[Customer]ValueSubtotalValueSubtotalValueSubtotalColumn Subtotal
Segment 11313133
Segment 22626266
Segment 33939399
Segment 441241241212
Segment 551551551515

(2) subtotal chanegs along [Period] selected, for exmaple, if I unselect 2023-03, the following table should return correct value:

[Period]2023-01 2023-02
[Customer]ValueSubtotalValueSubtotalColumn Subtotal
Segment 112122
Segment 224244
Segment 336366
Segment 448488
Segment 551051010

 

Can you help me correct my measure? Thank you in advance!

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @tsunamisabella 

Please try

Subtotal =
CALCULATE ( [a_measure], ALLSELECTED ( table_name[Period] ) )

View solution in original post

2 REPLIES 2
tamerj1
Super User
Super User

Hi @tsunamisabella 

Please try

Subtotal =
CALCULATE ( [a_measure], ALLSELECTED ( table_name[Period] ) )

OMG! Thank you for the swift reply and the simply & wonderful solution 🥰!

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.