nleuck_101's avatar
nleuck_101
Icon for Continued Contributor rankContinued Contributor
1 year ago
Status:
New

Issues with calculating previous day using Date table

I have a Date table and when I try to calculate previous day views I get Blank. It doesn't matter whether I try using the function PREVIOUSDAY or DATEADD. Now if I remove the Date table and use the date from my Views table it correctly calculates the previous day views if I use PREVIOUSDAY or DATEADD. Why isn't my Date table not working for my calculations. It's never done this before. Is this a bug?

The relationship from my Date table to my Views table is one to many if that helps.

4 Comments

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi nleuck_101 

     

    I'm a little confused about how did you do it? The function works well in my testing.

    Check if the relationship between your tables structured like this:

    How do you write a calculated column or measure?

     

    If possible, please share some raw data in your tables or create some sample data(exclude sensitive data) and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following links to share the required info:

    How to provide sample data in the Power BI Forum

    How to Get Your Question Answered Quickly

     

    And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

    How to upload PBI in Community

     

    Best Regards

    Zhengdong Xu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • nleuck_101's avatar
    nleuck_101
    Icon for Continued Contributor rankContinued Contributor

    Hello Anonymous 

    Could the issue be that my Date table goes to the end of the year? So when it's looking for previous day there's no data because it hasn't happened yet? It's looking at 12/30/2025 and I think it should be looking at 1/16/2025.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi nleuck_101 

     

    Sorry for the late reply.

    This does have the potential to cause the issue.

    Maybe you can try to create a new calendar table including the latest date and try again, the outcome of the PREVIOUSDAY() function could only being included in the table.

     

    Best Regards

    Zhengdong Xu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • nleuck_101's avatar
    nleuck_101
    Icon for Continued Contributor rankContinued Contributor

    Anonymous 

    PREVIOUSDAY was still not working. If I use DATEADD(column, -1, DAY) it now works.