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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
VistaDee
Frequent Visitor

Help with % in Matrix

Hi There

 

I have a matrix and it is made of as follows:

  • A SubOrderID (Unique ID)
  • Products
  • Invoice Total (this is a custom column that looking up the SubOrder & Product combo in another table and pulls back the invoice total: 
    CALCULATE(SUM('Invoices Totals'[Invoices Total]), FILTER(ALL('Invoices Totals'), 'Orders Total'[SubOrderID] = 'Invoices Totals'[SubOrderID] && 'Orders Total'[Product] = 'Invoices Totals'[Product]))
  • Purchases Total (same as Invoice Total)
  • Margin % : A custom column that works out as follows:  DIVIDE(('Orders Total'[Invoices Total] - 'Orders Total'[Purchases Total]), 'Orders Total'[Order Total])

 

Then I created a Matrix and added all these columns but my percentages arent coming out right. Its Summing them and I dont want to do it. The Average doesnt work either as the breakdown of Order/Product throws that out as well.... Ay ideas?

 

MATRIX WITH SUM OF %

VistaDee_0-1631030255471.png

 

MATRIX WITH AVG OF %

VistaDee_1-1631030345231.png

 

 

 

 

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

Hi @VistaDee 

I suggest you to build a Margin% measure based on your Margin%  custom column. Try HASONEVALUE function to show results you want in subtotal.

The measure should looks like as below.

 

Margin% Measure =
VAR Total_Invoices =
    SUMX ( ALL ( 'Invoices Totals' ), 'Invoices Totals'[Invoice Total] )
VAR Total_Purchases =
    SUMX ( ALL ( 'Purchases Total' ), 'Purchases Total'[Purchases Total] )
VAR Total_Order =
    SUMX ( ALL ( 'Orders Total' ), 'Orders Total'[Orders Total] )
VAR Subtotal =
    DIVIDE ( Total_Invoices - Total_Purchases, Total_Order )
RETURN
    IF ( HASONEVALUE ( [SubOrderID] ), [Margin%], Subtotal )

 

If this reply still couldn't help you solve your problem, please share a sample with me. And you can show me a screenshot of the result you want in subtotal. This will make it easier for me to understand your requirement.

 

Best Regards,
Rico Zhou

 

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

1 REPLY 1
v-rzhou-msft
Community Support
Community Support

Hi @VistaDee 

I suggest you to build a Margin% measure based on your Margin%  custom column. Try HASONEVALUE function to show results you want in subtotal.

The measure should looks like as below.

 

Margin% Measure =
VAR Total_Invoices =
    SUMX ( ALL ( 'Invoices Totals' ), 'Invoices Totals'[Invoice Total] )
VAR Total_Purchases =
    SUMX ( ALL ( 'Purchases Total' ), 'Purchases Total'[Purchases Total] )
VAR Total_Order =
    SUMX ( ALL ( 'Orders Total' ), 'Orders Total'[Orders Total] )
VAR Subtotal =
    DIVIDE ( Total_Invoices - Total_Purchases, Total_Order )
RETURN
    IF ( HASONEVALUE ( [SubOrderID] ), [Margin%], Subtotal )

 

If this reply still couldn't help you solve your problem, please share a sample with me. And you can show me a screenshot of the result you want in subtotal. This will make it easier for me to understand your requirement.

 

Best Regards,
Rico Zhou

 

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

 

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors