Forum Discussion

LeonardCs's avatar
LeonardCs
Icon for Helper I rankHelper I
2 years ago
Solved

NEED HELP WITH DAX

Hi everyone,    I have a table with some types of exams and I need to calculate total of them. The issue is that some exams are in column "Exames_Realizados" and some exams are in column "Exames_Ad...
  • sandrika's avatar
    2 years ago

    You can create a new table that combines the "Exames_Realizados" and "Exames_Adicionais" columns. Use the following DAX code:
    ExamsTable =
    UNION (
    SELECTCOLUMNS (
    YourTable,
    "Name", YourTable[Name],
    "Exam", YourTable[Exames_Realizados]
    ),
    SELECTCOLUMNS (
    YourTable,
    "Name", YourTable[Name],
    "Exam", YourTable[Exames_Adicionais]
    )
    )
    Replace 'YourTable' with the name of your original table.

    Next, you can create a measure to count the occurrences of each type of exam:
    TotalExams =
    COUNTROWS (
    FILTER (
    ExamsTable,
    ExamsTable[Exam] <> "AGUARDANDO" && ExamsTable[Exam] <> "SEGUIMENTO PELA ESF"
    )
    )