Forum Discussion

SamBowdell's avatar
SamBowdell
New Member
3 years ago
Solved

Retirement calculations

I have a table with employee data with the following information- Employee number, name, fte, dob, age, date    There is a row for every month they are employed with us. I need to show a bar char...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi SamBowdell ,

     

    I suggest you to create a data model as below.

    Fact table:

    Measure:

    Count by Age = 
    VAR _SELECTAGE =
        SELECTEDVALUE ( DimAge[Age] )
    VAR _STEP1 =
        ADDCOLUMNS (
            ALL ( 'Table' ),
            "Current Age", QUOTIENT ( DATEDIFF ( 'Table'[Dob], MAX ( DimDate[Date] ), MONTH ), 12 )
        )
    RETURN
        COUNTAX ( FILTER ( _STEP1, [Current Age] < _SELECTAGE ), [Name] )

    Result is as below.

     

    Best Regards,
    Rico Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.