Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Practice Exam Question, I think is incorrect answer

Here is the question and answer they say is slicer:  I think is is the Second one down.  Can you tell me what you think?

 

As part of a large HR project you are working with a dataset of company employees, both past and present. The data includes columns for EthnicGroup, PayTypeID, HireDate (the date they started work), TermDate (the date they left) and several other columns. You want to create a new Calculated Column that determines if the person was a bad hire based on a set of rules. If they were a bad hire then the result is 1, otherwise the Calculated Column displays a zero.

The bad hire rule is:

BadHire = If the person stayed at the company less than 61 days

Example: If a person joined the company on 27th June 2013 and left on 21st August 2013, then they would be a bad hire.

Which DAX expression would you use for this Calculated Column?
Slicer
IF(OR((([HireDate]-[TermDate])) >= 61,ISBLANK([TermDate])),0,1)
IF(((([HireDate]-[TermDate])*-1) < 61),1,0)
IF((([TermDate]-[HireDate])*-1) >= 61,0,1)
 
  • Hi Anonymous,

     

    By my test, the second formula should be right based on the three formulas.

     

    However, I think the below forumula will be better based on your requirement.

     

    Column =
    IF (
        OR (
            DATEDIFF ( 'Table1'[HireDate], 'Table1'[Termdate], DAY ) >= 61,
            ISBLANK ( 'Table1'[Termdate] )
        ),
        0,
        1
    )
    

     

    Hope this can help you.

     

    Best  Regards,

    Cherry

1 Reply

  • v-piga-msft's avatar
    v-piga-msft
    Resident Rockstar

    Hi Anonymous,

     

    By my test, the second formula should be right based on the three formulas.

     

    However, I think the below forumula will be better based on your requirement.

     

    Column =
    IF (
        OR (
            DATEDIFF ( 'Table1'[HireDate], 'Table1'[Termdate], DAY ) >= 61,
            ISBLANK ( 'Table1'[Termdate] )
        ),
        0,
        1
    )
    

     

    Hope this can help you.

     

    Best  Regards,

    Cherry