Forum Discussion

sebasjun's avatar
sebasjun
Helper I
8 years ago
Solved

PREVIOUSMONTH not work

Hello

 

I have a mistery....

 

I have a simple table and a simple previous month calculate measure

 

Booking Lines PM = CALCULATE(sum(Data[Booking Lines]);PREVIOUSMONTH(Data[Booking Month].[Date]))

 

 

Is correct ... But when apply a filter by month (example October) i show this 

 

I show a blank value in Previous Month why?

 

Best regards

 

 

  • parry2k's avatar
    parry2k
    8 years ago

    Looked at it and as suspected you have Create Month from Hoja1 table used on rows, please use "Date" column from calendar table on rows and that will do it. see image below.

     

6 Replies

  • You need date dimension for these kind of calculation which seems to be the reason that it is not working. There are many posts on how to create date/calendar dimension in powerbi.

    • sebasjun's avatar
      sebasjun
      Helper I

      Hello

       

      Yes! I can try reading other post. But not running 

       

      Step 1: Create a Calendar datatable --> Calendar = CALENDARAUTO()

       

      Step 2: Relationship

       

       

      Step 3: Change Formula

      Booking Lines PM = CALCULATE(sum(Data[Booking Lines]);PREVIOUSMONTH('Calendar'[Date]))

       

       

      Any ideas ... 

      • parry2k's avatar
        parry2k
        Super User

        In your table what date are you using, use it from your new calendar table.