Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hello,
I'm working on a report in which we a testing a new calculation method for contribution margin. One of the tasks involve creating a measure to be included in both table and visual objects, that enables the user to change the period that is calculated.
Current idea is to use the Parameter Numeric Range (1-24 months) and use that as a variable in the DATEADD function. However, I can't get this to work correctly, as I'm only able to return the sum of the measure for the specific start month selected (i.e., if selecting 4, the measure should calculate a cumulative sum of the 4 latest months prior to current month).
The current DAX measure is shown below and is returning the sum of the period 4 months prior to the comparison/current period. Worth noting, the data model is a composite model with below DAX relating to the only imported table apart from the DQ data model. However, this DAX should also be copied to other sales variables subsequently, that is resided in the DQ data model - based on current research, since the Date Dimension is within the DQ model, this shouldn't be an issue in any case?
At last, below measure was formulated by a former colleague, no longer part of the company.
I'm a little confused. Are you saying that you want the measure to return the sum of a period defined as number of months before the current month, and not including the current month? So, today is 9/20, and a user selects 4, you want the measure to sum for the period of May 1st - August 31st?
You then mention "The current DAX measure is shown below and is returning the sum of the period 4 months prior to the comparison/current period. " Do you mean it's only returning the sum of May 1st to May 31st?
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
78 | |
78 | |
59 | |
35 | |
33 |
User | Count |
---|---|
100 | |
62 | |
56 | |
47 | |
41 |