Forum Discussion
column calculated in relation to another column
- 3 years ago
Apologies, somehow I missed your reply on this. Please try
Measur =
VAR CurrentIDTable =
CALCULATETABLE (
VALUES ( GESTION[Statut dossier] ),
ALLSELECTED (),
VALUES ( DOSSIER[Identifiant dossier] )
)
RETURN
IF (
NOT ISEMPTY ( GESTION ) && ISEMPTY ( EXCEPT ( { "Cancelled" }, CurrentIDTable ) ),
IF (
NOT ISEMPTY ( INTERSECT ( { "Accepted", "Paid" }, CurrentIDTable ) ),
1,
0
),
0
)
Hi UserSam123
please try
CalculatedColumn =
VAR CurrentIDTable =
CALCULATETABLE ( VALUES ( 'Table'[Stat] ), ALLEXCEPT ( 'Table', 'Table'[ID] ) )
RETURN
IF (
"Cancelled" IN CurrentIDTable,
IF (
NOT ISEMPTY ( INTERSECT ( { "Accepted", "Paid" }, CurrentIDTable ) ),
1,
0
),
0
)
Hello;
Thank you for your feedback. I tested it on a pbix file and it works fine.
The aim is to do it from an azure analysis services cube. When I put in the code I get this error message: Failed to save changes on the server. Error returned:
"An unexpected error has occurred (file "xldc.cpp", line 3861, function "XLAggImpl_Set<11,1>: : Accumulate").
Microsoft.AnalysisServices.BackEnd.DataModelingSandboxTabular.ExecuteEngineCodeInBackground(OperationType type, Boolean cancellable, AMOCode code, Boolean raiseEvents)
à Microsoft.AnalysisServices.BackEnd.DataModelingSandboxTabular.DoExecuteEngineCode(OperationType type, OperationCancellability cancellable, AMOCode code, Boolean raiseEvents)
à Microsoft.AnalysisServices.BackEnd.DataModelingSandbox.ExecuteEngineCode(OperationType type, OperationCancellability cancellable, AMOCode code, Boolean raiseEvents)
à Microsoft.AnalysisServices.BackEnd.SandboxTransaction.CommitInternal(Boolean finalCommit)
----------------------------
à Microsoft.AnalysisServices.BackEnd.SandboxTransaction.CommitInternal(Boolean finalCommit)
à Microsoft.AnalysisServices.Common.SandboxEditor.ChangeFormula(TableWidgetPanel currentTable, IList`1 colIndices, IList`1 names, IList`1 expressions, Boolean doFormulaBarCommit, IList`1 displayIndices)
Would you like to know why?