Forum Discussion

blockobito's avatar
blockobito
Helper I
3 years ago
Solved

Donut Chart Count.

How to show data within over 30 Days and less than 30 days from a specific day? 
  • amitchandak's avatar
    3 years ago

    blockobito , in case you are not using date as a legend on donut visual

     

    Rolling 30 day = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],MAX('Date'[Date]),-30,Day))

     

    Rolling 30 to 60 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],max(dateadd('Date'[Date],-30,day)),-30,day))

     

    LTD(complete till date before 30 ) =
    var _max = if(isfiltered('Date'),MAX( 'Date'[Date]) -30, today())
    var _min = minx(all('Date'), 'Date'[Date]) // or minx(allselected('Date'), 'Date'[Date])
    return
    CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))

     

    Rolling Days Formula: https://youtu.be/cJVj5nhkKBw

     

    In case you want to date as a legend, You need a slicer on an independent date table

     

    //Date1 is independent Date table, Date is joined with Table
    new measure =
    var _max = maxx(allselected(Date1),Date1[Date])
    var _min = _max -30
    return
    calculate( sum(Table[Value]), filter('Date', 'Date'[Date] >=_min && 'Date'[Date] <=_max))

     

    Need of an Independent Date Table:https://www.youtube.com/watch?v=44fGGmg9fHI