Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hello forum!
I need your help for the following measure. I want to break down the total of a column by the values of the records that compose it in a matrix visualization:
For exemple: the total of column FACT must be distributed between the records for the TIPUS COLABORADOR column. I created a new measure called DESFACT with the formula of the image but the total value is not the same that the column FACT and the distrubution is not correct either. The Total columns on the right are correct and the distribution is correct too, but for every type of document (column TIPUS with de BONO and EXPED values) are not correct. What is wrong? I don't know how to filter on the formula of the new measure.
This is the DAX formula:
DESFACT =
VAR TotalFAC = CALCULATE(SUM(Tabla1[FACT]);ALLSELECTED(Tabla1))
VAR TotalCOST = CALCULATE(SUM(Tabla1[COST]);ALLSELECTED(Tabla1))
RETURN
(TotalFAC * SUM(Tabla1[COST]))/ TotalCOST
Thanks!
Solved! Go to Solution.
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!
Hi @Raul,
try to change you formula to something like this:
DESFACT =
VAR TotalFAC =
CALCULATE (
SUM ( Tabla1[FACT] );
ALLSELECTED ( Tabla1 );
FIRSTNONBLANK ( Tabla1[TIPUS]; SUM ( Tabla1[FACT] ) )
)
VAR TotalCOST =
CALCULATE (
SUM ( Tabla1[COST] );
ALLSELECTED ( Tabla1 );
FIRSTNONBLANK ( Tabla1[TIPUS]; SUM ( Tabla1[FACT] ) )
)
RETURN
( TotalFAC * SUM ( Tabla1[COST] ) )
/ TotalCOSTCheck if it works, did not tried in the computer.
Regards,
MFelix
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsThanks 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!
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.