powerbi - Power BI current day sum vs previous day sum -


very new power bi, appreciated.

i have database table has fields category, subcategory, value , reportdate. value not sales figure, it's point-in-time valuation (think stock value). gets populated every day, have rows contiguous dates , value changing each day.

i'm looking make table report has category, value today, value 30 days ago , value 90 days ago (these value columns need summed category). delta columns added bonus. data required in table think i'm not sure how approach it.

i have created date table (like here http://community.powerbi.com/t5/desktop/how-to-calculate-month-over-month-sales/m-p/63647/highlight/false#m26258) hoping i'm not getting anywhere.

i've tried adding these measures report:

currentdayvalue = calculate(sum(valuationtable[value]), dateadd(datetable[date], 0, month))

30dayvalue = calculate(sum(valuationtable[value]), dateadd(datetable[date], -30, day))

but both same value (and same adding [value] column). if don't display measures , show [value] , add filter on reportdate, can see dates , selecting 1 date results in value expect. can filter on previous date , see correct value date, want these side side in report.

i think have works. interested in hearing feedback if approach or if there's better way:

previous value =  calculate (     sum (valuationtable[value]),         filter (             (valuationtable),             countrows (                 filter (                     valuationtable,                     earlier (valuationtable[reportdate]) = dateadd(valuationtable[reportdate], -30, day)                         && earlier (valuationtable[category]) = valuationtable[category]                  )             )       ) ) 

Comments

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -