Forum Discussion

Iamnvt's avatar
Iamnvt
Continued Contributor
6 years ago
Solved

Count inside a virtual table

hi,   I have a table, and need to summarize for few key columns: ProductCategorySales A AB 1 B AB 2 C AB 3 D BB 33 E BB 4 D BB 1   How can I get the summarize f...
  • camargos88's avatar
    6 years ago

    Hi Iamnvt ,

     

    Try this code:

     

    Table 2 =
    VAR _tb = SUMMARIZE('Table','Table'[Category],'Table'[Product])
    RETURN ADDCOLUMNS(_tb, "Count of Category", COUNTX(FILTER(_tb, 'Table'[Category] = EARLIER('Table'[Category])), 'Table'[Category]))