Forum Discussion
c5966
7 years agoHelper I
Calculated field with matrix
I need some support in calculated field in matrix table. Any help is much appreciated. I have 2 columns CLASS_CONF and Change_class (which has 2 seperate values ClassChange and NoClassChange). ...
- 7 years ago
Thank you for your help
I understood how to do this, first I need to group my class confidence and then use your divide function.
Accuracy = CALCULATE(divide(sum('table'[NoClassChange]), sum('table'[ClassChange])+sum('table'[NoClassChange])), fILTER(ALL('table'), 'table'[MEDTR_FRONT_VDAC_CLASS_CONF] = EARLIER('table'[MEDTR_FRONT_VDAC_CLASS_CONF])))
Nathaniel_C
7 years agoCommunity Champion
Not sure what you are asking...should be the same with 1 or 0. Just reference the column name. Divide will return a blank unless you give it an alternative return for a divide by zero. See Dax Divide on the web:
Syntax
DAXCopy
DIVIDE(<numerator>, <denominator> [,<alternateresult>]) Parameters
Term Definition
| numerator | The dividend or number to divide. |
| denominator | The divisor or number to divide by. |
| alternateresult | (Optional) The value returned when division by zero results in an error. When not provided, the default value is BLANK(). |
Return value
A decimal number.
Remarks
Alternate result on divide by 0 must be a constant.
If this answers you issue please mark as the solution.
Nathaniel
c5966
7 years agoHelper I
Thank you for your help
I understood how to do this, first I need to group my class confidence and then use your divide function.
Accuracy = CALCULATE(divide(sum('table'[NoClassChange]), sum('table'[ClassChange])+sum('table'[NoClassChange])), fILTER(ALL('table'), 'table'[MEDTR_FRONT_VDAC_CLASS_CONF] = EARLIER('table'[MEDTR_FRONT_VDAC_CLASS_CONF])))