Forum Discussion

sbenzaquen's avatar
sbenzaquen
Helper I
5 years ago
Solved

Setting a reporting date

Hi,   I need help to find a solution to the following problem:   I'm building a report that summarizes how time is spent within the organization which is updated on a monthly basis. The trends fo...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi  sbenzaquen ,

    I create some data:

    Here are the steps you can follow:

    Create calendar.

    Date = CALENDARAUTO()

    Report transaction time as of Mar-21:

    Create measure.

    report transaction time as of Mar-21 =
    var _select= SELECTEDVALUE('Date'[Date])
    return
    IF(_select=DATE(YEAR(_select),3,21),
    CALCULATE(MAX('Table'[transaction hour]),FILTER(ALL('Table'),'Table'[date]=_select)),
    CALCULATE(MAX('Table'[transaction hour]),FILTER(ALL('Table'),'Table'[date]=DATE(YEAR(_select),3,21))))

    Growth vs. prior month:

    1. Create measure.

    This month =
    var _date=SELECTEDVALUE('Date'[Date])
    return
    CALCULATE(SUM('Table'[amount]),FILTER(ALL('Table'),[date]>=DATE(YEAR(_date),MONTH(_date),1)&&[date]<=_date))
    Last month =
    var _date=SELECTEDVALUE('Date'[Date])
    return
    CALCULATE(SUM('Table'[amount]),FILTER(ALL('Table'),[date]>=DATE(YEAR(_date),MONTH(_date)-1,1)&&[date]<=DATE(YEAR(_date),MONTH(_date)-1,DAY(_date))))

    2. Using [Date] in the Date table as a slicer, put [This month] and [Last month] into the KPI.

    Result:

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.