Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

SUMMARIZE USING DISTINCTCOUNT

Hello, all! 

 

I need help with the following issue:

 

I have this table:

YearMonthIDText

2021

Jan123A
2021Feb123A
2021Mar123A
2021Mar123B
2021Mar123C

 

I need to do a distinct count to see how many Texts i have for Year/Month/ID. 

 

So I need the following output

 

YearMonthIDText
2021Jan1231
2021Feb1231
2021Mar1233

 

I've tried something like this

 

 

test = (DISTINCTCOUNT(
    SUMMARIZE ( Consult, Consult[date].[year], Consult[date].[month], Consult[id]),
    [Text])

 

 

But it didn't work 😞

I believe SUMMARIZE can solve the poblem but if there is any other option, please, Im all ears.

 

So, if anyone coulp help me, Ill be plesead 🙂

  • Anonymous Oh, sorry, should just be this:

    test = COUNTROWS(
        SUMMARIZE ( Consult, Consult[date].[year], Consult[date].[month], Consult[id]) )

3 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Anonymous Try:

    test = (COUNTROWS(
        SUMMARIZE ( Consult, Consult[date].[year], Consult[date].[month], Consult[id]),
        [Text])

    SUMMARIZE will already return each row as a distinct combination of what you are summarizing over.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Its not recognizing the column 'Text' as a column 😕

      • Greg_Deckler's avatar
        Greg_Deckler
        Community Champion

        Anonymous Oh, sorry, should just be this:

        test = COUNTROWS(
            SUMMARIZE ( Consult, Consult[date].[year], Consult[date].[month], Consult[id]) )