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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Matrix not adding up correctly

Hi everyone!

 

I'm trying to create a matrix visualization in which, depending on the day of the month, will display different measures.

On the rows i have item ID (from a sales table) and on the columns i have the days of the month (from a calendar table). Both tables are linked by a date key.

The thing is that the row subtotals are not adding up correctly.

 

What have i done so far?

Before day 15, i have the sum of units sold. And on or after the 16th only a number 2.

pre15 =
IF (
    DAY ( LASTNONBLANK ( FECHAS[FECHA], 1 ) ) <= 15,
    SUM ( DS_SUGERENCIA_COMPRA[VENTAS] ),
    2
)

...and then created a little fix to see if I had different results:

pre15 FIX =
IF (
    HASONEVALUE ( FECHAS[Day] ),
    [pre15],
    SUMX ( VALUES ( DS_SUGERENCIA_COMPRA[SKU] ), [pre15] )
)

(for this last one, I followed the steps listed in this post --> Subtotals and Grand Totals That Add Up “Correctly”)

 

So i get the following:

image.pngWhat I want is that grand total to sum the month total for that SKU (and the many others i'm not showing for this example purpose).

 

What am I doing wrong? Robot Frustrated

 

 

1 ACCEPTED SOLUTION
dax
Community Support
Community Support

Hi santt66,

 

You could try to follow below steps:

create a meaurse 

day's value =
IF ( LASTNONBLANK ( 'calendar'[day], 1 ) <= 15, SUM ( Sheet7[ventas] ), 2 )

monthly value =
SUMX (
FILTER (
ALLSELECTED ( 'calendar' ),
'calendar'[year] = MAX ( 'calendar'[year] )
&& 'calendar'[month] = MAX ( 'calendar'[month] )
),
[day's value]
)

modify = IF(HASONEVALUE('calendar'[day]),[day's value],[monthly value])

 Then use this in Matrix like below

83.PNG

Best Regards,

Zoe Zhi

 

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

3 REPLIES 3
dax
Community Support
Community Support

Hi santt66,

 

You could try to follow below steps:

create a meaurse 

day's value =
IF ( LASTNONBLANK ( 'calendar'[day], 1 ) <= 15, SUM ( Sheet7[ventas] ), 2 )

monthly value =
SUMX (
FILTER (
ALLSELECTED ( 'calendar' ),
'calendar'[year] = MAX ( 'calendar'[year] )
&& 'calendar'[month] = MAX ( 'calendar'[month] )
),
[day's value]
)

modify = IF(HASONEVALUE('calendar'[day]),[day's value],[monthly value])

 Then use this in Matrix like below

83.PNG

Best Regards,

Zoe Zhi

 

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

Anonymous
Not applicable

Hi @dax 

As I continued working, I encounter a similar problem but this time regarding subtotals and grand totals;

print1.png

 

This time, the suggestion you gave me did not work... or maybe i'm doing something wrong again? 

Anonymous
Not applicable

Thanks a lot @dax ! That seems to be working just fine Smiley Very Happy

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors