Forum Discussion

Silvard's avatar
Silvard
Resolver I
1 year ago
Solved

Checking for multiple Ids

Problem:

I need to identify completed JobId's, ideally as a calculated column. I have 1 fact table with JobID and ApplicationID and two dim tables, one for JobID and one for ApplicationID.

Each JobID can contain many ApplicationID's. I need a calculated column that checks if a candidate (ApplicationId) has commenced and under that same JobId, check if there are other candidates found suitable who are still going through the stages of offer and onboarding. If there aren't, the job is considered complete. This is Recruitment based.

I have tried the below but it doesn't give the correct result.

 

I greatly appreciate your help!

 

 

IsJobArchivable = VAR CurrentJobID = 'Fact Table'[JobID] VAR HasIncompleteNotOffer = CALCULATE( COUNTROWS('Application Dimension'), FILTER( 'Application Dimension', 'Application Dimension'[JobID] = CurrentJobID && 'Application Dimension'[Application Stage] <> "Offer" && NOT 'Application Dimension'[Complete Application] ) ) VAR HasComplete = CALCULATE( COUNTROWS('Application Dimension'), FILTER( 'Application Dimension', 'Application Dimension'[JobID] = CurrentJobID && 'Application Dimension'[Complete Application] ) ) RETURN IF(HasComplete > 0 && HasIncompleteNotOffer = 0, TRUE(), FALSE())

  • Silvard's avatar
    Silvard
    1 year ago

    Thanks to gmsamborn for suggestion the below solution - I only needed to change under VAR _NotCommenced the Application Dimension[Status] to IN {Offer, Background Checks, Onboarding}

     

    IsJobArchivable = 
    VAR _Job = [JobID]
    VAR _Commenced =
        COUNTROWS( 
            FILTER( 
                'FactTable',
                'FactTable'[JobID] = _Job
                    && RELATED( 'Application Dimension'[Status] ) = "Commenced"
            )
        )
    VAR _NOTCommenced =
        COUNTROWS( 
            FILTER( 
                'FactTable',
                'FactTable'[JobID] = _Job
                    && RELATED( 'Application Dimension'[Status] ) <> "Commenced"
            )
        )
    VAR _Result =
        IF(
            _Commenced > 0
                && _NOTCommenced = 0,
            TRUE(),
            FALSE()
        )
    RETURN
        _Result

     

8 Replies

  • hi Silvard ,

     

    You can write the calculation as follows:

     

    JobStatus =
    VAR CurrentJobID = FactTable[JobID]
    VAR CandidatesCommenced =
    CALCULATE(
    COUNTROWS(FactTable),
    FactTable[JobID] = CurrentJobID,
    RELATED(DimApplication[Status]) = "Commenced"
    )
    VAR CandidatesInOfferOrOnboarding =
    CALCULATE(
    COUNTROWS(FactTable),
    FactTable[JobID] = CurrentJobID,
    RELATED(DimApplication[Status]) IN {"Offer", "Onboarding"}
    )
    RETURN
    IF(
    CandidatesCommenced > 0 && CandidatesInOfferOrOnboarding = 0,
    "Completed",
    "Not Completed"
    )

     

    make sure to update the status based on your's.

     

    If this post helps, then I would appreciate a thumbs up 👍  and mark it as the solution to help the other members find it more quickly. 

    • Silvard's avatar
      Silvard
      Resolver I

      Hi Selva,

       

      Thanks your prompt response.

       

      I have tried the above but am getting the below error:

       

      True/False expression does not specify a column. Each True/False expressions used as a table filter expression must refer to exactly one column.

      How can we rewrite the formula please?

      • Silvard's avatar
        Silvard
        Resolver I

        I updated the formula using relatedtable instead, but It's still not producing the expected result.

        In fact another formula, much simpler, produces the same result.

         

        ApplicationisCompleted =
        IF(DimApplication[Status])<>"", Completed)

        This column contains the candidates who have finalised their onboarding and otherwise "".

        I somehow need a formula that checks this column and where there are "Completes", check the JobID for any other ApplicationID's that are going through the offer and onboarding stages.

        This column is what equals the below in your formula.

        RELATED(DimApplication[Status]) = "Commenced"