help with dax formula

metal123

New Member
Joined
Mar 26, 2015
Messages
9
[TABLE="width: 500"]
<tbody>[TR]
[TD]Company[/TD]
[TD]Products[/TD]
[TD]Amount[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Chiquita[/TD]
[TD]Bananas[/TD]
[TD]1[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Dole[/TD]
[TD]Pineapples[/TD]
[TD]2[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Dole[/TD]
[TD]Coconuts[/TD]
[TD]4[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Chiquita[/TD]
[TD]Bananas[/TD]
[TD]1[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Chiquita[/TD]
[TD]Bananas[/TD]
[TD]1[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Dole[/TD]
[TD]Pineapples[/TD]
[TD]5[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Chiquita[/TD]
[TD]Pineapples[/TD]
[TD]6[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Chiquita[/TD]
[TD]Coconuts[/TD]
[TD]7[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Dole[/TD]
[TD]Pineapples[/TD]
[TD]1[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Based on the data table, I was wondering if anyone knows how to write a DAX formula where it will sum the amounts of all the dole product and the ratio of the amounts of a specific product to their total amounts.

For example,

total amount of Dole products: 12

amt of Dole Pineapples: 8

% of Pineapples to total of dole products: 8/12 or 66.67%
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
For the first value, a SUMIF statement will do.
=SUMIF(A2:A10,"Dole",C2:C10)
For the second value, you'll need SUMIFS which uses statements ie. "Dole", "Pinnapples"
=SUMIFS(C2:C10,A2:A10,"Dole",B2:B10,"Pineapples")
Then for the percentage you just subtract the pineapples from the total and format cell as percentage.
=H4/H2
If you want this as one formula just join them together.
=SUMIFS(C2:C10,A2:A10,"Dole",B2:B10,"Pineapples")/SUMIF(A2:A10,"Dole",C2:C10)
 
Upvote 0
I realise I was too quick reading through your question and just answered the sum as a normal formula not DAX
I could be very wrong, though what I put there should still work for you, just changing the ranges
A2:A10 would be [Company] ; B2:B10 would be [Products] ; C2;C10 would be [Amount]

eg.
=SUMIFS([Amount],[Company],"Dole",[Products],"Pineapples")/SUMIF([Company],"Dole",[Amount])
 
Upvote 0
Hi
Code:
=CALCULATE(SUM('MyTable'[Amount]),'MyTable'[Compay]="Dole" && ['MyTable'[Products]="Pineapples")/
CALCULATE(SUM('MyTable'[Amount]),'MyTable'[Compay]="Dole")
Regards,
 
Upvote 0

Forum statistics

Threads
1,224,153
Messages
6,176,729
Members
452,740
Latest member
MrCY

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top