Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
o59393
Post Prodigy
Post Prodigy

Calculate function not filtering launched projects

Hi all !

 

I created a dax function (product kpi) to calculate the % of how good we are at launching projects. The rule is simple

 

1-(Real days-Theorical Days)/Theorical Days

 

It calcualtes it only for launched projects in the column Status.

 

The problem I have is that the metric is calculating me the % for non launched projects or that have a Real days cell empty.

 

As seen below:

 

projects.PNG

When I select 2019 Q4, there are 3 projects. One already launched for manager ZZZ. Which is ok to reflect the % of the dax metric.

 

the manager AAA and XXX have on going projects, therefore the metric should return no % since it hasnt launched. 

 

Can you please advise how to do that?

 

I attach excel and pbi.

 

https://www.mediafire.com/file/0zham95mumjpqw2/projects.pbix/file

https://www.mediafire.com/file/k3hsf9n2o4tvbad/query_%2813%29.xlsx/file

 

Thanks.

1 ACCEPTED SOLUTION
TomMartens
Super User
Super User

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:

image.png

Hopefully this is what you are looking for.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

3 REPLIES 3
TomMartens
Super User
Super User

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:

image.png

Hopefully this is what you are looking for.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Nevermind, I got it 🙂

 

Thanks a mill for the help!!!

 

 

Hi Tom!

 

Thanks a lot for the reply. Can you share the pbix?

 

Thanks!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.