Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
10 years ago
Solved

Calculated Measure Based on Criteria - Aggregation Issue?

Hi All,    I think I have an issue with the aggregation of my data and I know it's because of my unfamilarity with DAX.   Here's the situation, I need to create a goal metric based off of my past...
  • greggyb's avatar
    greggyb
    10 years ago
    1. This isn't a problem with the last year logic in my original reply. Just change the name of DimDate to the appropriate table.
    2. Really, a goal should be precomputed. In your original question it was simple enough to not care much about how to implement as a measure, but with the details you're revealing, I'd suggest not calculating this as a measure. Your sales last year are known at the time of model refresh, and will never change. These are two defining attributes of values that should be pre-computed. I'd recommend doing this in ETL, either in your source system if you have access/authority to initiate those changes, or as a part of your Power Query step before loading this data to the model. See a sample below for how you might implement this:

    Here you go, a nice sample. You can manually enter a multiplier table ('Enter Data') and then copy your sales query and join in the multipliers for each year, then do your multiplication. The result is a FactGoal table that you can then just have some simple measures defined against. This is how we'll set up this sort of reporting for any of our clients.