Forum Discussion
Calculate function not filtering launched projects
- 6 years ago
Hey o59393 ,
the reason why there is a percentage, is because the formula is reduced to this, when the status does not equal "launched":
1 - NULLthis leads to a percentage of 100% as NULL is coerced to 0 (zero)
I guess this provides what you are looking for:
Product KPI = var _percentage = (CALCULATE(SUM(Table_query__13[Tech_COMM_Days_Real]),Table_query__13[Status]="Launched")-CALCULATE(SUM(Table_query__13[Tech_COMM_Days_Gantt]),Table_query__13[Status]="Launched"))/CALCULATE(SUM(Table_query__13[Tech_COMM_Days_Gantt]),ABS(Table_query__13[Status]="Launched")) return IF( _percentage == BLANK() , BLANK() , 1 - _percentage )Here the result of the "calculation" is stored to the variable "_percentage".
Then using the strict operator == (indeed 2 equal signs) allows to check if the value of the variable is BLANK() meaning NULL.
Using this formula, the matrix visual just contains this:
Hopefully this is what you are looking for.
Regards,
Tom
Hey o59393 ,
the reason why there is a percentage, is because the formula is reduced to this, when the status does not equal "launched":
1 - NULL
this leads to a percentage of 100% as NULL is coerced to 0 (zero)
I guess this provides what you are looking for:
Product KPI =
var _percentage = (CALCULATE(SUM(Table_query__13[Tech_COMM_Days_Real]),Table_query__13[Status]="Launched")-CALCULATE(SUM(Table_query__13[Tech_COMM_Days_Gantt]),Table_query__13[Status]="Launched"))/CALCULATE(SUM(Table_query__13[Tech_COMM_Days_Gantt]),ABS(Table_query__13[Status]="Launched"))
return
IF( _percentage == BLANK()
, BLANK()
, 1 - _percentage
)
Here the result of the "calculation" is stored to the variable "_percentage".
Then using the strict operator == (indeed 2 equal signs) allows to check if the value of the variable is BLANK() meaning NULL.
Using this formula, the matrix visual just contains this:
Hopefully this is what you are looking for.
Regards,
Tom
Nevermind, I got it 🙂
Thanks a mill for the help!!!