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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

IF & Substraction formulas showing totals wrong

Hello everyone,

 

I might be doing something wrong with my formulas as it calculates the totals as it shouldn't. 

 

The table looks like this when I add the candidate's ID to see where the issues are (that means that each row is a different candidate): 

 

PBIDesktop_HitMfMLmGk.png

 

The formula for the column in the middle is:

  

From Interview Scheduled to Offer = IF ( ISBLANK([_Average days to Offer]) || ISBLANK([_Average days to Interview - Scheduled]), BLANK(),([_Average days to Offer] - [_Average days to Interview - Scheduled]))
 
The 1st and last column have these formulas which apply to Whole number columns (that have a different number of days in it or null rows): 
 
_Average days to Interview - ScheduledCALCULATE( AVERAGE([_Days Application to Interview - Scheduled]), FILTER(report, report[_Days Application to Interview - Scheduled] <> 0 ))
 
_Average days to Offer = CALCULATE( AVERAGE([_Days Application to Offer]), FILTER(report, report[_Days Application to Offer] <> 0 ))
 
The purpose of the calculations is to ignore all the results that are blank on the other side but in the Total, it doesn't ignore them. In this case, the TOTAL of From Interview Scheduled to Offer should be BLANK() and not "-38"
 
Is there anything I can do to fix this? 
 
Thank you very much!
1 ACCEPTED SOLUTION

Have you looked at the AVERAGEX-function? It allows for a IF-statement inside the expression part, so you can do something like this

average =
AVERAGEX (
    'Table';
    IF (
        NOT ( ISBLANK ( [measure1] ) ) && NOT ( ISBLANK ( [measure2] ) );
        [measure2] - [measure1];
        BLANK ()
    )
)



 

 

View solution in original post

4 REPLIES 4
sturlaws
Resident Rockstar
Resident Rockstar

Hi,

there might be something I don't understand, but in the total neither [_Average days to Interview - Scheduled] or [_Average days to Offer] is blank, so you get 38 - 76 = -38. Why should it be blank?

 

best regards,

 

Anonymous
Not applicable

hi @sturlaws 

 

Thanks for asking, 

 

What I was trying to do is to calculate the time between Interview Scheduled to Offer 

 

That's why I might be wrong in calculating an average of the 2 separately and then subtract them. The only reason I did the average was to take out the 0's and have a measure available.

 

What I wanted to achieve with the formula below is to have a sort of calculation per Candidate ID that if they didn't pass through Interview Scheduled and Offer, to not calculate a subtraction. And as you can see in the image I attached the column is blank. But the Total is still -38. 

 

From Interview Scheduled to Offer = IF ( ISBLANK([_Average days to Offer]) || ISBLANK([_Average days to Interview - Scheduled]), BLANK(),([_Average days to Offer] - [_Average days to Interview - Scheduled]))

 

I don't know how to tackle this. I'm out of ideas. What I know is that I have to add something to my formula to be based on each candidate ID. 

 

Hope I made it more clear. 

Have you looked at the AVERAGEX-function? It allows for a IF-statement inside the expression part, so you can do something like this

average =
AVERAGEX (
    'Table';
    IF (
        NOT ( ISBLANK ( [measure1] ) ) && NOT ( ISBLANK ( [measure2] ) );
        [measure2] - [measure1];
        BLANK ()
    )
)



 

 

Anonymous
Not applicable

It works @sturlaws !!! Thank you very much !!! 😄

 

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.