Forum Discussion
Apply filter to a measure
- 9 years ago
I found the solution. The measure must have the following formula:
DESFACT =
VAR TotalFAC = CALCULATE(SUM(Tabla1[FACT]);ALLSELECTED(Tabla1[COLABORADOR]))
VAR TotalCOST = CALCULATE(SUM(Tabla1[COST]);ALLSELECTED(Tabla1[COLABORADOR]))
RETURN
(TotalFAC * SUM(Tabla1[COST]))/ TotalCOSTThanks MFelix for your help!
Thanks for your answer MFelix,
Now, the totals for the columns FACT and DESFACT have the same value but don't appear the distribution for the column COLABORADOR and the Total colum of DESFACT it's not correct, like this:
I need the DESFACT column to distribute the total for the records in the COLABORADOR column and that the total is the correct one.
This is a summary of the table source of the Power BI file:
| COLABORADOR | COST | FACTURACIO | TIPUS |
| 2514,85 | BONO | ||
| MR | 116,5 | BONO | |
| RC | 200 | BONO | |
| SM | 609,7 | BONO | |
| 1481,92 | EXPED | ||
| MR | 100 | EXPED | |
| RC | 305 | EXPED | |
| SM | 79,5 | EXPED |
Thank you.
I found the solution. The measure must have the following formula:
DESFACT =
VAR TotalFAC = CALCULATE(SUM(Tabla1[FACT]);ALLSELECTED(Tabla1[COLABORADOR]))
VAR TotalCOST = CALCULATE(SUM(Tabla1[COST]);ALLSELECTED(Tabla1[COLABORADOR]))
RETURN
(TotalFAC * SUM(Tabla1[COST]))/ TotalCOST
Thanks MFelix for your help!