Forum Discussion

jordancole517's avatar
jordancole517
Regular Visitor
3 years ago
Solved

UseRelationship at the day level is not working (sample model attached)

I've attached a very simple model for you all to be able to see what is going on quicker! 🙂   PowerBI Sample File    I'm sure I'm just a bonehead and missing something simple, but I'm attempting...
  • jordancole517's avatar
    jordancole517
    3 years ago

    I think the answer is just that I need to have an ALLEXCEPT instead of the ALL in my calculate statement. I guess it matters because the values are the same in both filters. Said another way they are both spelled the same way and appear the same vs the week dates which have the week and year and, therefore, are unique to each filter. 

     

    Previous Date Sum =

     CALCULATE(
         [Date Sum]
            ,ALLEXCEPT('Date','Date'[Day of Week Name])
            ,USERELATIONSHIP('Data Table'[Business Date],'Previous Date'[Date])
     )

     

    Attaching a sample file for anybody that comes across the same issue. Seems like a very common use case for time comparisons that aren't always something simple like YoY, WoW, etc. I also have to use a retail calendar, so I can't use these naturally embedded functions. This will work for retail calendared folks as well.

     

    NOTE: The variance calculations in this file don't have any kind of weighting/normalization between the two time periods to level set the time periods. If you want to compare time periods of different durations then you should just multiply your calculated sum accounts by a separate normalization factor that you'll create.

     

    Solution!