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
alexbalazsalex
Helper IV
Helper IV

Subtotal Formula

Dear All,

 

I need your support for the below Case:

CALCULATE(SUM('Stock DB 3'[Cost Impact]),LASTDATE('Dictionary Date'[Invoicing Date]))
 
 q1q2q3q4total
 11111
Total11111

 

 

Basically The value of Q is conisdered the last month of the Q but thsi formula is appleid also to subtotal.

 

What i woudl liek to work independently so expected subtotal in above case is 1+1+1+1=4

 

MAny Thanks,

Alex

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @alexbalazsalex 

 

Based on your description, I created data to reproduce your scenario.

a1.png

 

You may create a calculated table as follows.

 

Dictionary Date = CALENDARAUTO( )

 

 

Here is the relationship between two tables.

a2.png

 

Then you can create a measure as below.

 

total = SUMX( 
    SUMMARIZE(
        'Dictionary Date',
        'Dictionary Date'[Invoicing Date].[QuarterNo],
        "total",
        CALCULATE(
                SUMX(
                    ALLSELECTED('Stock DB 3'),
                    'Stock DB 3'[Cost Impact]
                ),
                LASTDATE('Stock DB 3'[Date])
        )
    ),
    [total]
)

 

 

Result:

a3.png

 

If I misunderstand your thought, please show me your sample data and expected output. Do mask sensitive data before uploading. Thanks.

 

Best Regards

Allan

 

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

2 REPLIES 2
v-alq-msft
Community Support
Community Support

Hi, @alexbalazsalex 

 

If you take the answer of someone, please mark it as the solution to help the other members who have same problems find it more quickly. If not, let me know and I'll try to help you further. Thanks.
 
Best Regards
Allan
v-alq-msft
Community Support
Community Support

Hi, @alexbalazsalex 

 

Based on your description, I created data to reproduce your scenario.

a1.png

 

You may create a calculated table as follows.

 

Dictionary Date = CALENDARAUTO( )

 

 

Here is the relationship between two tables.

a2.png

 

Then you can create a measure as below.

 

total = SUMX( 
    SUMMARIZE(
        'Dictionary Date',
        'Dictionary Date'[Invoicing Date].[QuarterNo],
        "total",
        CALCULATE(
                SUMX(
                    ALLSELECTED('Stock DB 3'),
                    'Stock DB 3'[Cost Impact]
                ),
                LASTDATE('Stock DB 3'[Date])
        )
    ),
    [total]
)

 

 

Result:

a3.png

 

If I misunderstand your thought, please show me your sample data and expected output. Do mask sensitive data before uploading. Thanks.

 

Best Regards

Allan

 

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

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