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
paisen
New Member

Constant Sum Value in Matrix

Hello I would like some help in trying to get constant sum in my matrix.

I have a product table and a product sales table. I created a matrix that shows products and their sales from each quarter. I want to add another value column that shows a constant sum of particular product, for all of the products in that quarter. So the resulting visual should look something like this.

Product   Product Type   Total Sales Q1   Total Sales Q1 of Sports   
ASports1020
BSports1020
CCooking120
DBooks220
EElectronics320

 

I'm planning to use the value for a specific calculation. Thank you in advance for any future comments!


All the best,

Paisen

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

Thanks for the reply from @PhilipTreacy  , please allow me to provide another insight: 

Hi  @paisen ,

I created some data:

vyangliumsft_0-1713509146841.png

 

Here are the steps you can follow:

1. Create calculated column.

Total Sales Q1 =
IF(
     QUARTER('All_Table'[Date])=1&&     'All_Table'[Date]=MINX(FILTER(ALL('All_Table'),'All_Table'[Product]=EARLIER('All_Table'[Product])&&'All_Table'[Product Type]=EARLIER('All_Table'[Product Type])&&QUARTER('All_Table'[Date])=1),[Date]),
SUMX(
    FILTER(ALL('All_Table'),
    QUARTER('All_Table'[Date])=1&&'All_Table'[Product]=EARLIER('All_Table'[Product])),[Sales]))
Total Sales Q1 of Sports =
IF(
     QUARTER('All_Table'[Date])=1&&    'All_Table'[Date]=MINX(FILTER(ALL('All_Table'),'All_Table'[Product]=EARLIER('All_Table'[Product])&&'All_Table'[Product Type]=EARLIER('All_Table'[Product Type])&&QUARTER('All_Table'[Date])=1),[Date]),
SUMX(
    FILTER(ALL('All_Table'),
    'All_Table'[Product Type] ="Sports"),[Total Sales Q1]))
Total Sales Q1/Total Sales Q1 of Sports =
DIVIDE(
    [Total Sales Q1],[Total Sales Q1 of Sports])

vyangliumsft_1-1713509146844.png

2. Turn off – Row headers – Options – Stepped layout.

vyangliumsft_2-1713509205447.png

3. Result:

vyangliumsft_3-1713509205452.png

 

 

Best Regards,

Liu Yang

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

5 REPLIES 5
v-yangliu-msft
Community Support
Community Support

Thanks for the reply from @PhilipTreacy  , please allow me to provide another insight: 

Hi  @paisen ,

I created some data:

vyangliumsft_0-1713509146841.png

 

Here are the steps you can follow:

1. Create calculated column.

Total Sales Q1 =
IF(
     QUARTER('All_Table'[Date])=1&&     'All_Table'[Date]=MINX(FILTER(ALL('All_Table'),'All_Table'[Product]=EARLIER('All_Table'[Product])&&'All_Table'[Product Type]=EARLIER('All_Table'[Product Type])&&QUARTER('All_Table'[Date])=1),[Date]),
SUMX(
    FILTER(ALL('All_Table'),
    QUARTER('All_Table'[Date])=1&&'All_Table'[Product]=EARLIER('All_Table'[Product])),[Sales]))
Total Sales Q1 of Sports =
IF(
     QUARTER('All_Table'[Date])=1&&    'All_Table'[Date]=MINX(FILTER(ALL('All_Table'),'All_Table'[Product]=EARLIER('All_Table'[Product])&&'All_Table'[Product Type]=EARLIER('All_Table'[Product Type])&&QUARTER('All_Table'[Date])=1),[Date]),
SUMX(
    FILTER(ALL('All_Table'),
    'All_Table'[Product Type] ="Sports"),[Total Sales Q1]))
Total Sales Q1/Total Sales Q1 of Sports =
DIVIDE(
    [Total Sales Q1],[Total Sales Q1 of Sports])

vyangliumsft_1-1713509146844.png

2. Turn off – Row headers – Options – Stepped layout.

vyangliumsft_2-1713509205447.png

3. Result:

vyangliumsft_3-1713509205452.png

 

 

Best Regards,

Liu Yang

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

 

PhilipTreacy
Super User
Super User

@paisen 

 

Right, so you want a column for Sports, a column for Cooking, a column for Books etc?  Seems like a lot of redundant data being displayed.  You'd be better off to have a separate visual showing these totals, like a card for each Product Type or just a table?

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Not really. I understand this could be shown in better ways but I just need this particular value. My goal is to be able to show (Total Sales Q1 / Total Sales Q1 of Sports). So in this case it would be

Product  Type  Total Sales Q1  Total Sales Q1 of Sports  Total Sales Q1/Total Sales Q1 of Sports  
ASports10200.50
BSports10200.50
CCooking1200.05

 

I know it doesn't make sense with this product example, but I'm just using these as placeholders for what calculation I'm trying to get. I just really need to get this constant sum value for the matrix.

PhilipTreacy
Super User
Super User

Hi @paisen 

 

I'm not following how you get 20 for all the Products when you say you want a sum for each product ?

 

Please provide some source data and an example of how you are getting 20 as a result of your calculation.

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Hello, sorry for the confusion. To clarify my goal is to add another value colum that shows a constant total sale of a particular product type. So in my example, I got 20 because the total sales of sports (Product A & B) is 20. I hope this helps.

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.