Forum Discussion

Revathi_Kannan's avatar
4 years ago
Solved

COUNTROWS WITH MULTIPLE COLUMNS

Hi all,   I am looking for the solution for the past 2 weeks but i am unable to find the DAX functions which i can do it in excel.  Please refer the below image.. I have 2 columns but my result ha...
  • Jihwan_Kim's avatar
    4 years ago

    Hi,

    Please check the below DAX formula and the attached pbix file.

    It is for creating a new table.

     

    New Table = 
    ADDCOLUMNS (
        VALUES ( Data[Employee] ),
        "@CategorySummary",
            CALCULATE (
                IF (
                    COUNTROWS ( VALUES ( Data[Category] ) ) = 2,
                    "BothCategory",
                    VALUES ( Data[Category] )
                )
            )
    )