cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
nsonnad
Helper II
Helper II

Get % risk numbers based on Sum of Parent product

@dax @powerx @BIHelp  Need help  i have the following table with parent and child products and would like to derive the risk measures ($amount) in % . as shown in the example . need to create a measure for Column I      E.g. Child product "AA" is a sub product of parent "A" , hence the risk numbers should be a % of the parent total sum which in this case is $10,000.00  for 31st Aug , %risk for row 4 should be H3/SUM(G2:G3) , same for row 2,3 , & 5 . Similarly for Product B category .    Appreciate your help in advance

 

i tried using Calculate(SUM(Total),ALLEXCEPT(Product,Date,ParentProduct)) & assigning the value using SWITH statement but no luck

 

 
 

image.png

3 REPLIES 3
BIHelp
Frequent Visitor

Risk% =
Var Risk =SUM('Table'[Risk])
Var Parent/ChildSale = CALCULATE(
SUM
('Table'[Total]),
ALLEXCEPT('Table', 'Table'[Parent Product], 'Table'[Date], 'Table'[Child Product])
)
Return
DIVIDE( Risk, Parent/ChildSale)
daxer
Solution Sage
Solution Sage

If this is to be a calculated column, then...

[% Risk] = // calculated column
var __parent = T[Parent Product]
var __child = T[Child]
var __date = T[Date]
var __childTotal = T[Total]
var __parentTotal =
	sumx(
		filter(
			T,
			T[Parent Product] = __parent
			&&
			T[Date] = __date
			&&
			T[Child] = __child
		),
		T[Total]
	)
var __risk =
	// If you want to see this number as
	// a percentage, you should use the
	// formatting feature of PBI and not
	// fiddle with this number directly.
	divide(
		__childTotal,
		__parentTotal
	)
return
	__risk
daxer
Solution Sage
Solution Sage

Is this a calculated column or a measure you want?

Helpful resources

Announcements
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Get Ready for Power BI Dev Camp

Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.