Forum Discussion

ciarano's avatar
ciarano
Frequent Visitor
9 years ago
Solved

Current day sum vs previous day sum

Hi,   Very new to Power BI, so any help is appreciated.   I have a database table that has fields Category, SubCategory, Value and ReportDate. The Value is not a sales figure, it's a point-in-tim...
  • ciarano's avatar
    9 years ago

    I think I have something that works.

    Would be interested in hearing feedback if this is a good approach or if there's a better way:

     

    Previous Value = 
    CALCULATE (
        SUM (ValuationTable[Value]),
            FILTER (
                ALL (ValuationTable),
                COUNTROWS (
                    FILTER (
                        ValuationTable,
                        EARLIER (ValuationTable[ReportDate]) = DATEADD(ValuationTable[ReportDate], -30, DAY)
                            && EARLIER (ValuationTable[Category]) = ValuationTable[Category]
                     )
                )
          )
    )