Forum Discussion

love's avatar
love
Helper I
8 years ago
Solved

How to count rows with additional logic (countrows/countx)

Hello.   I have a data set that looks like this:     Task Config. Time Task 1 A 20 Task 1 A 60 Task 1 B 214 Task 2 A 8 Task 2 B 215 Task 3 A 67 Task 3 B 21 Task 3 B 57   If I create a measure ...
  • TomMartens's avatar
    8 years ago

    Hey,

     

    maybe this measure provides what you are looking for.

    Countrows Summarize = 
    COUNTROWS(
        SUMMARIZE('Table1'
            ,Table1[Task]
            ,Table1[Config.]
        )
    ) 

    It results to 6.

     

    Using SUMMARIZE allows to create a table using just the columns you want.

     

    You can also use
    ADDCOLUMNS(
        SUMMARIZE(...)

        ,"NewColumnName 1", Expression

        ,...
    )

     

    For more examples using SUMMARIZE and ADDCOLUMNS please have a look here:

    https://www.sqlbi.com/articles/best-practices-using-summarize-and-addcolumns/

     

    Hopefully this is what you are looking for

     

    Regards

    Tom