Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago

Cumulative count with several entries for same date

Hello Power BI geniuses (and people with the same issue as me...)

 

I am trying to write a measure to give me a cumulative count over a period of time, using this:

Cumulative stuff = CALCULATE(COUNTA('My Table'[stuff I want to count]),FILTER('My Table'),('DateTable'[Date])<=today()))

 

 

The problem is, in My Table, I can have more than one row for a single date:

My Table - DateStuff i want to count
28-Dec-17A
01-Feb-18B
22-Feb-18C
07-Mar-18D
09-Mar-18E
10-Mar-18F
11-Mar-18G
11-Mar-18H
15-Mar-18I
15-Mar-18J

 

And I get an error message telling me "a single value for the column date cannot be determined..."

I've tried grouping my table per date and and count of rows, but it doesn't seem to solve the issue.

My date table was creating using Date =CALENDAR (DATE(2000;1;1); DATE(2025;12;31)) AND i manually checked, I don't have any duplicates in that table :/

 

Can anybody suggest a solution?

Thanks in advance :D

 

2 Replies

  • v-yulgu-msft's avatar
    v-yulgu-msft
    Icon for Microsoft Employee rankMicrosoft Employee

    Hi Anonymous,

     

    Please refer to this measure:

    Cumulative stuff =
    CALCULATE (
        COUNT ( 'My Table'[Stuff] ),
        FILTER ( ALL ( 'My Table' ), 'My Table'[Date] <= TODAY () )
    )

    Best regards,

    Yuliana Gu

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you sooooo much for taking the time (I'm going crazy) - the error message is gone but I must be doing something wrong because it gives me the same value for each date (looks like it's the total count of [stuff]). How do I get it to give me the cumulative count for each day?

       

      Initial table

      My Table - DateStuff
      28-Dec-17A
      01-Feb-18B
      22-Feb-18C
      07-Mar-18D
      09-Mar-18E
      10-Mar-18F
      11-Mar-18G
      11-Mar-18H
      15-Mar-18I
      15-Mar-18J

       

      What I see now:

      My Table - DateCumulative count
      28-Dec-1710
      01-Feb-1810
      22-Feb-1810
      07-Mar-1810
      09-Mar-1810
      10-Mar-1810
      11-Mar-1810
      15-Mar-1810

      What I'd like to see:

      My Table - DateCumulative count
      28-Dec-171
      01-Feb-182
      22-Feb-183
      07-Mar-184
      09-Mar-185
      10-Mar-186
      11-Mar-188
      15-Mar-1810