Forum Discussion
sumif or equivalent
- 3 years ago
Hi Cyrilbrd ,
Here is my example:
Please try:
Measure for value 1 = var _a = SUM('Table'[Value1]) var _b = CALCULATE(SUM('Table'[Value1]),REMOVEFILTERS('Table'[Code])) return DIVIDE(_a,_b) Measure for value 2 = var _a = SUM('Table'[Value2]) var _b = CALCULATE(SUM('Table'[Value2]),REMOVEFILTERS('Table'[Code])) return DIVIDE(_a,_b)Output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Allow me to rephrase it.
| Code | Value1 | Value2 |
| A | 12 | 9 |
| B | 10 | 8 |
| A | 13 | 7 |
| C | 9 | 5 |
| A | 11 | 7 |
With the code being ten of thousand or rows.
Filters at page level as to show data only for selected codes is existing.
Slicer to show locations, or statuses or department are also existing and are applied via interactions.
CUrrently both solutions are showing incorrect info.
The solution of Padycosmos is the closest but works only if all filters and slicers are off.
Code A ratio for value 1 could be total COG (Cost Of Goods) in a specific location the it could be for all locations.
Thus allowing comparison of KPI.
If I was to "Show value as Percent of grand total", then it would give me a percenatge that would not work unless ALL codes were displayed.
Showing only selected codes would render "Show value as Percent of grand total" useless.