Forum Discussion

usomaraju's avatar
usomaraju
Icon for Helper II rankHelper II
6 years ago

Get each month total and average based on date

hello All,

 

I need help on calculating the monthly total and average for the data.

i have the data like below

IDDateDays
1632/28/2020 7:373
1642/25/2020 12:470
1653/2/2020 15:435
1663/3/2020 4:096
1733/3/2020 12:350
1743/19/2020 19:4616
1753/19/2020 19:5016
1783/4/2020 14:270
1793/4/2020 14:340
1803/4/2020 14:360
1813/4/2020 15:592
1823/4/2020 15:598
1853/10/2020 14:084
1863/10/2020 14:084
1873/10/2020 14:510
1883/10/2020 14:533
1893/11/2020 16:333
1903/11/2020 16:410
1913/12/2020 8:000
1923/12/2020 8:010
1953/12/2020 16:581
1963/12/2020 17:011
1973/13/2020 8:050
1983/13/2020 8:060
1993/13/2020 13:190
2003/13/2020 13:100
2013/27/2020 11:029
2023/27/2020 11:0215
2044/16/2020 19:526
2054/16/2020 19:496
2065/6/2020 21:136
2075/6/2020 21:126

need to get the output as below

MonthTotalAverage
Jan-2000
Feb-2033
Mar-20930.2
Apr-20126
May-20126
Jun-2000
Jul-2000
Aug-2000
Sep-2000
Oct-2000
Nov-2000
Dec-2000

 

the calculation is for the month Jan 2020. i dont have any records, so the value is zero.

for the month feb 2020, i see two records (2/28/2020 and 2/25/2020 with valuse 3 and 0), here the total is 3+0=3

and the average is 3/1 = 3.

and also same for April, the total is 6+6 =12 and the average is 12/2 = 6.

 

Can anyone help me with this? 

 

Thanks

18 Replies

    • usomaraju's avatar
      usomaraju
      Icon for Helper II rankHelper II

      Hi Sturla,

       

      Thank you for your quick response, but when i used same formulas i see same result for all months.

       

      the steps i followed, on my table, by using measure i applied the below formula

      Total number of days = var _s = SUM('Table'[Days]) return
      IF(ISBLANK(_s),0,_s)
       
      which is displaying same no of days as in total no of days
       
      and same for average also.I 'm not sure where i missed.
       
      thanks
      • sturlaws's avatar
        sturlaws
        Icon for Resident Rockstar rankResident Rockstar

        Did you create a date-table? And a relationship between the date table and your main table?