Forum Discussion

amelia's avatar
05-25-2022
Solved

PREV query getting error

Hi Sisense community, 

My goal here is to calculate the total number of subscriptions churned between the current week and the last 4 weeks. However, I am getting an error that says there is an issue querying the data model - would anyone be able to advise? 

  • Hi amelia ,

    Not sure why RANGE function is not working. Please try below formula instead (sum up values of 4 weeks).

    ([Total Subscription churned], PREV([Weeks in Date of Joining], 0)) + 
    ([Total Subscription churned], PREV([Weeks in Date of Joining], 1)) + 
    ([Total Subscription churned], PREV([Weeks in Date of Joining], 2)) + 
    ([Total Subscription churned], PREV([Weeks in Date of Joining], 3))

    -Hari

     

4 Replies

Replies have been turned off for this discussion
    • amelia's avatar
      amelia
      ETL

      Hi Hakim, thanks for the reply! However, when I do this, I do not get a rolling 4 weeks, and only get the last 4 weeks from the most current date. Is there a way to get a rolling 4 weeks based on the current week that I am looking at instead? Thank you 😄

       

      • harikm007's avatar
        harikm007
        Data Warehouse

        Hi amelia ,

        Not sure why RANGE function is not working. Please try below formula instead (sum up values of 4 weeks).

        ([Total Subscription churned], PREV([Weeks in Date of Joining], 0)) + 
        ([Total Subscription churned], PREV([Weeks in Date of Joining], 1)) + 
        ([Total Subscription churned], PREV([Weeks in Date of Joining], 2)) + 
        ([Total Subscription churned], PREV([Weeks in Date of Joining], 3))

        -Hari