Forum Discussion

Danielktn's avatar
Danielktn
Frequent Visitor
6 years ago
Solved

Set up a day 0

Hi, I am doing an analisys for the Corona Virus. My table has the following columns: -Date -Cases -Country and a dates table I would like to graph the cummulated cases by country and dates. I ge...
  • Greg_Deckler's avatar
    Greg_Deckler
    6 years ago

    Danielktn - Found the file, now will see if I can find the thread. But the calculated column was something like this:

     

    Days since 100th case column = 
      VAR __Table = FILTER('time_series_19-covid-Confirmed',[Country/Region] = EARLIER([Country/Region]))
      VAR __Date = 'time_series_19-covid-Confirmed'[Period]
      VAR __Table1 = 
          ADDCOLUMNS(
            __Table,
            "__Cases",
            SUMX(FILTER(__Table,[Period] <= EARLIER([Period])),[Value])
          )
      VAR __100Day = MINX(FILTER(__Table1,[__Cases] >= 100),[Period])
      VAR __Days = (__Date - __100Day) * 1.
    RETURN
      IF(__Days < 1,BLANK(),__Days)