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! Learn more

Reply
angelocecinati
Frequent Visitor

Subtotal YTD in Matrix

Hello,

 

I've created a YTD measure in a matrix and I'd like to show a subtotal summing years by category. The problem I'm facing is that the subtotal shows just the last year and does not aggregate the years.SubtotalYTD.PNG

 

Anyone has ideas about how to fix it?

Thanks in advance,

 

Angelo

1 ACCEPTED SOLUTION

The TOTALYTD function works in the year context only. Thus I created a custom mesaure has suggested in this post:

https://community.powerbi.com/t5/Desktop/Cumulative-Running-Totals-in-DAX/m-p/42608



Cumulative Value =
IF(
    MIN(Dim_Calendar[Date])<=CALCULATE(
            MAX(Dim_Calendar[Date]);
                ALL(TF));
                    CALCULATE([Valore_M];
                                FILTER(All(Dim_Calendar[Month]);Dim_Calendar[Month]<=MAX((Dim_Calendar[Month]
            ))));BLANK())

 

Now it works!

 

 

 

 

 

View solution in original post

3 REPLIES 3
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @angelocecinati,

 

Please try this:

ValueYTD =
SUMX ( sales_table, TOTALYTD ( [Value_M], 'Dim_Calendar'[Date] ) )

1.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

The TOTALYTD function works in the year context only. Thus I created a custom mesaure has suggested in this post:

https://community.powerbi.com/t5/Desktop/Cumulative-Running-Totals-in-DAX/m-p/42608



Cumulative Value =
IF(
    MIN(Dim_Calendar[Date])<=CALCULATE(
            MAX(Dim_Calendar[Date]);
                ALL(TF));
                    CALCULATE([Valore_M];
                                FILTER(All(Dim_Calendar[Month]);Dim_Calendar[Month]<=MAX((Dim_Calendar[Month]
            ))));BLANK())

 

Now it works!

 

 

 

 

 

Hi Yuliana,

 

Thanks for your reply. This solution makes the subtotal works properly. Unfortunatly the YTD measure does not work over the months, cause it should sum the passed period values. SubtotalYTD.PNG.

I think that if I put the sumx function in front of the measure it computes the YTD for the single row of the fact table.

If I change the order of the matrix it works!

SubtotalYTD1.PNG

Do I have to change the model behind?

Thanks again,

 

Angelo

 

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.

Top Solution Authors