Forum Discussion

LeonardCs's avatar
LeonardCs
Helper 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_Adicionais". For exemple:

 

NameExames_RealizadosExames_Adicionais
LeonardoBIÓPSIA POR ESTEREOTAXIARNM
RafaelBIÓPSIA POR USGBIOPSIA DE LINFONODO
WillBIÓPISIA TIPO1BIÓPSIA POR USG
SophieMMGAGUARDANDO
TaylorPAAF LINFONODOBIÓPSIA POR ESTEREOTAXIA
PittyPAAF TIREOIDESEGUIMENTO PELA ESF
BryanRNMUSG
MariaUSGBIOPSIA DE LINFONODO
JohnDOPPLER USG

 

I need to know and show how much exams for types were carried out

  • 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"
    )
    )

2 Replies

  • 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"
    )
    )

    • LeonardCs's avatar
      LeonardCs
      Helper I

      Thank you sooo much. I followed your dax and finally solved the issue. 🙏