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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Dave_Gugg
Helper I
Helper I

Getting ridiculously wrong subtotals in matrix visual

I am trying to build a visual with three rows and no columns.  When I add a couple of values that I am bringing in from a data set, the subtotals are either correct for one or the other, not both:

 

Net Ship D 0.PNG

Above, Net Shipped Units subtotal correctly

Net Ship U 0.PNG

Above, Net Shipped Dollars subtotal correctly.

 

It appears whichever column I add latest has the correct subtotal.  Both of these metrics are coming straight from my fact table - there are no calculations done on them from inside of Power BI, aside from the option to sum them within the matrix visual.

 

However, I next try to add a custom metric, and now I get a number that is even more wrong than 0:

Net Ship U with CM.PNG

 

The calculation for the custom metric is pretty basic:

Net Ship GM% = DIVIDE(SUM(Demand[Ship $]) - SUM(Demand[COGS]),sum(Demand[Net Ship $])) 

What am I doing that is causing these subtotals to aggregate incorrectly?

 

Thank you

 

 

10 REPLIES 10
v-huizhn-msft
Employee
Employee

@Dave_Gugg

As highlighted in yellow, returning the 0 is weird. Please check your data type and create again if it still has the issue. Essentially, it will return the total sum of all Net Ship in AUTO.

1.png

 

I try to reproduce your scenario using the follow sample data.


2.png

Then, I create below measure, and get expected result without issue.

Net Ship GM% = DIVIDE(SUM(Test[Net Ship $]),SUM(Test[Net ship U]))

3.png

For you issue, what are “Ship” and “COGS” columns in the custom metric? If there is a logical error, could you please share the sample date or screenshot for further analysis?

Best Regards,
Angelia

I have rebuilt this visual with a new pbix file and found I could replicate it by adding a filter on Net Ship U is greater than 0.  I had put this filter in my original matrix because without it I am seeing all products in my Product Dimension table, whether or not they had any sales associated with them.  @v-huizhn-msft, when you put a filter on your Net Ship U in the Visual's filters does that allow you to replicate my strange results?

I should have added that these rows without values only show up when I added a custom metric to the table:

Item Rank NC$ = RANKX(ALL('Product'[Item Number and Description]),Demand[Total NC$],,DESC)

This is a metric that ranks the items in the matrix by Net Contribution Dollars.

@Dave_Gugg   I put  Net Ship U in the Visual's filters, it return the expected result without any issue. Please review the below screenshot.

11.png

Best Regars,
Angelia

@v-huizhn-msft, are you using the table or matrix for your test?  I am using the matrix.  

@Dave_Gugg  Sorry for inconvience, I reproduce it using Metrix and it works fine, please review below screenshot.

11.png

Best Regards,
Angelia 

@v-huizhn-msft, thank you for sticking with this.  The Net Ship $ and Net ship U need to be in the Values section, not the Rows section.

@Dave_Gugg I am very gald to help you. The Net Ship $ and Net ship U are placed in the Values section. Please the below screenshot.

11.png

 

22.png

 

If you have any question, please feel free to ask.

Best Regards,
Angelia
 

Your set up looks the same as mine.  The only other thing that I can think to check is I am using Direct Query.  Are you using Direct Query or loading your data?

@Dave_Gugg I click Get Date->Excel, and load my data. Please check if loading data is successfuly.  Jenerally, the operation will works fine if we load data successfully.

Best Regards,
Angelia

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.