Forum Discussion
Remove All Filters but Specify New Filter
- 6 years ago
Try this. I used the logic I gave for the total, then used a slight different logic for the current total used as the numerator.
Type A Total = VAR varTypeATotal = SUMX( FILTER( ALL( 'Data Table' ), 'Data Table'[Type] = "A" ), 'Data Table'[Total] ) VAR varCurrentTotal = SUMX( FILTER( 'Data Table', 'Data Table'[Type] = "A" ), 'Data Table'[Total] ) VAR varPercentOfTotal = DIVIDE(varCurrentTotal, varTypeATotal, 0) RETURN varPercentOfTotal
Hmm, the measure filters based on "row2", but when I select a filter the measure changes. This makes it seem the ALL(Table) is not working.
You'll need to give more info, or perhaps share a PBIX file with some sample data.
How to get good help fast. Help us help you.
How to Get Your Question Answered Quickly
How to provide sample data in the Power BI Forum
- t-dahen6 years agoMicrosoft Employee
edhans
My data looks like this:Name Type Total Bob A 1 Bob B 2 Alice A 3 Alice B 4 I want an absolute count of Total for Type "A". In this case it will be 4. If I have a Name filter in my report and select "Bob", I do not want this measure to be 1, still 4.
My end goal is to have for each Name, the percentage they account for in Type "A". Note there is no Type context below.Name PercentageInA Bob .25 Alice .75 - edhans6 years agoCommunity Champion
Try this. I used the logic I gave for the total, then used a slight different logic for the current total used as the numerator.
Type A Total = VAR varTypeATotal = SUMX( FILTER( ALL( 'Data Table' ), 'Data Table'[Type] = "A" ), 'Data Table'[Total] ) VAR varCurrentTotal = SUMX( FILTER( 'Data Table', 'Data Table'[Type] = "A" ), 'Data Table'[Total] ) VAR varPercentOfTotal = DIVIDE(varCurrentTotal, varTypeATotal, 0) RETURN varPercentOfTotal- t-dahen6 years agoMicrosoft Employee
Perfect, thanks!
Similarily related, is getting a percentage breakdown for a Measure across all the names possible?
So for Bob and Alice, let's say an arbitrary measure returns 60 and 40 respectively. Can I get:
Name PercentWithMeasure Bob .60 Alice .40