Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

table does not summarize when converted to matrix

Hi, I have a table with dates, that uses previousmonth and previous year dax functions.  The data shows perfectly in table form, each day showing the correct PREVIOUSDAY, PREVIOUSMONTH and PREVIOUSYEAR calculations.  The date comes from the same table where my data is, not from the calendar table.

 

So I added a date heirarchy so i can drill though from day to month. When I did that, I lost all the calculations.
It seems that calculation only works when it's referring to the values, day by day.

How do I create a matrix that properly calculates the day, month, year, etc. no matter which level I move through the matrix changing the headers from day to month to year, etc.

Any help is appreciated.

3 Replies

  • some_bih's avatar
    some_bih
    Community Champion

    Hi Anonymous  PREVIOUSDAY, PREVIOUSMONTH and PREVIOUSYEAR, functions you named are part of time intelligence group for DAX and best work when applied to Calendar / Date table. Removing date column from Calendar / Date table and replacing it with other column (date propably) recalculate it and  it's result. Hope this help

  • Anonymous's avatar
    Anonymous
    Not applicable

    Thanks but for one of the functions, PREVIOUSMONTH, 

    _PREVIOUSMONTH = CALCULATE(SUM('DataBricks - UserViews'[ReturnVisit]),PREVIOUSMONTH('DataBricks - UserViews'[date]))+0

    When I change the DataBricks - UserViews'[date]
    To 'Calendar'[date], The data returns nothing and it simply doesn't work.
     
  • some_bih's avatar
    some_bih
    Community Champion

    Hi Anonymous it seems that, your PREVIOUSMONTH is column not function, lol. Nevermind, share more details and model, pbi filenif possible.