Forum Discussion

PatrickByGecko's avatar
6 years ago
Solved

Creating a new table from 2 others with a calculation

Hello I want to create a new table from two others. I have one table of DATES with one column Dates (from 1/1/2019 to 31/12/2050 for instance) and an other one with WORKERS information (Name, Sex, ...
  • Anonymous's avatar
    Anonymous
    6 years ago

    PatrickByGecko  - You could create the following Calculated Table in DAX:

    New = 
    ADDCOLUMNS(Dates, 
        "Nbr Male", 
        COUNTROWS(
            FILTER(
                ALL(Workers),
                Workers[DateEntry] <= Dates[Date] && Workers[Sex] = "male"
            )
        ),
       "Nbr Female", 
        COUNTROWS(
            FILTER(
                ALL(Workers),
                Workers[DateEntry] <= Dates[Date] && Workers[Sex] = "female"
            )
        )
    )