Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Countifs in Power BI

I think I might just be thinking of this wrong but I'm struggling on how to do a measure similar to a COUNTIFS function in Excel.

 

This is how my data is structured:

 

And this is how I would like my output table to look:

 

So it's pretty much counting the times the score is above 12 for each person.

 

I tried a countx function in Power BI but I got en error I believe on the ">=12" part saying it couldn't be a boolean string.

  • Anonymous's avatar
    Anonymous
    8 years ago

    Anonymous Both of these would work, I made these 2 to le you know you can do anything you want but there are differents ways to do it. In this case I prefer to use the second one, you could say is a large formula, but that has more considerations.

     

    For you I would recommend to analyse them. 

     

    =CALCULATE(COUNTROWS(TableName),TableName[Score]>=12)

     

    =COUNTROWS(CALCULATETABLE(SUMMARIZE(TableName,TableName[Name],TableName[Score]),TableName[Score]>=12))

     

    Good Luck!

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi,

     

    You can try and create a new column:

                  Test = if(Table[Score]>=12, 1, 0),

    then bring the name in one table along with the new create Test column.

     

    Regards,

    Ioana

  • Anonymous's avatar
    Anonymous
    Not applicable

    Anonymous Both of these would work, I made these 2 to le you know you can do anything you want but there are differents ways to do it. In this case I prefer to use the second one, you could say is a large formula, but that has more considerations.

     

    For you I would recommend to analyse them. 

     

    =CALCULATE(COUNTROWS(TableName),TableName[Score]>=12)

     

    =COUNTROWS(CALCULATETABLE(SUMMARIZE(TableName,TableName[Name],TableName[Score]),TableName[Score]>=12))

     

    Good Luck!