Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago

Last year count with userelationship dax

Hi experts,
Need to calculate last year new hire count 
Please help.

 

New Hire =
CALCULATE(
COUNT('Exit,Roster,Leave,WFH'[ID]),
USERELATIONSHIP('Calendar'[Date], 'Roster'[Hire Date]))

New Hire PY =
CALCULATE( DISTINCTCOUNT('Roster'[ID]),
SAMEPERIODLASTYEAR('Calendar'[Date]),
USERELATIONSHIP('Calendar'[Date], 'Roster'[Hire Date]))

getting blank output for second formula

6 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous  This modified formula will count the number of new hires for the previous year based on the 'Hire Date' relationship with the 'Calendar' table.
    CALCULATE(
    COUNT('Exit,Roster,Leave,WFH'[Axtria ID]),
    USERELATIONSHIP('Calendar'[Date], 'Roster'[Hire Date]),
    'Calendar'[Year] = YEAR(TODAY()) - 1
    )

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Anonymous, I tried above formula, shwoing blank value 

      • sergej_og's avatar
        sergej_og
        Icon for Super User rankSuper User

        Date intelligence....try to use DATEADD or SAMEPRIODELASTYEAR to get your result.

        CALCULATE(
             COUNT(ccc),
             DATEADD(xxx),
             USERALTIONSHIP(fff)
        )


        Regards.

  • Hi,

    Share the download link of the PBI file.  Show the problem there clearly.