Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Datesinperiod not working as expected?

Why would 1 day in the same month suddenly remove a full month from below measure?

 

Rolling PTLIQ = 
CALCULATE(SUM('NetSuite_P&L_Monthly'[Monthly PTLIQ]), DATESINPERIOD(DateDimension[Date],
                        LASTDATE(DateDimension[Date]),-1,Year
                       )
         )

 

Also side note, if anybody knows how to make this divide by number of entries correctly that would be appreciated, right now i'm just dividing the total by 12 in another measure. it's dirty but I needed to get it working :(

  • Anonymous's avatar
    Anonymous
    7 years ago

    Hey Greg, your code was a little too much for me. I went with something simpler that seems to give me the results I need.

     

     
    Rolling PTLIQ = 
    
    CALCULATE(SUM('NetSuite_P&L_Monthly'[Monthly PTLIQ]), DATESINPERIOD(DateDimension[Date],
                            LASTDATE(PREVIOUSDAY(PREVIOUSMONTH(DateDimension[Date]))),-1,Year
                           )
             )
     

2 Replies