Forum Discussion
masitbaha
8 years agoRegular Visitor
Getting % by group (stacked column chart) - with filtered item
Hi guys. Need help. My data is like this; Week Product Qty Pass/Fail EXPECTED_RESULT 1 A 2 Fail 2/(2+3+4+6) = 13....
- 8 years ago
As a MEASURE try this one
Measure = IF ( HASONEVALUE ( TableName[Qty] ), VALUES ( TableName[Qty] ) / CALCULATE ( SUM ( TableName[Qty] ), FILTER ( ALL ( TableName ), TableName[Week] = VALUES ( TableName[Week] ) ) ) )
Zubair_Muhammad
Community Champion
8 years ago
As a MEASURE try this one
Measure =
IF (
HASONEVALUE ( TableName[Qty] ),
VALUES ( TableName[Qty] )
/ CALCULATE (
SUM ( TableName[Qty] ),
FILTER ( ALL ( TableName ), TableName[Week] = VALUES ( TableName[Week] ) )
)
)masitbaha
8 years agoRegular Visitor
this works nicely. i also found another way to get the same result using measure;
Percentage = sum(Table[Qty])/CALCULATE(sum(Table[Qty]),GROUPBY(Table,Table[Week]),all(Table))