Forum Discussion
CAGR for multiple periods
- Anonymous9 years ago
Hi Quiyun,
So if I create a measure
Beginning Date Measure = date(year(max('Table'[Year]))-3,12,31)
then
BeginValueMeasure = CALCULATE(sum('Table'[AUM]),filter('Table','Table'[Year]='Table'[Beginning Date Measure]))
Returns a blank.
However, if I create a column
Beg Date Col = date(year(max('Table'[Year]))-3,12,31)
then
Begin Value = CALCULATE(sum('Table'[AUM]),filter('Table','Table'[Year]='Table'[Beg Date Col]))
returns the correct value.
New to DAX, so I'm not sure why the measure didn't work. I'm interested in finding out the reasoning for intellectual reasons, but the work issue has been resolved. Thanks for your help.
Raghu - 9 years ago
Hi Anonymous,
Glad to hear that the issue has been solved.
In my opinion, the calculated column Beg Date Col will return values based on each year value in the table. While the Beginning Date Measure will return date based on the visual context to calculate Max(Year) then return the value. This should be the difference. For more information, you can learn measures and calculated columns below:
Tutorial: Create your own measures in Power BI Desktop
Tutorial: Create calculated columns in Power BI Desktop
Best Regards,
Qiuyun Yu
Hi Anonymous,
Assume the Beginning Date 3yr = date(year(max('Table'[Year]))-3,12,31) returns the date 12/31/2013, does the table contains a record about 12/31/2013? If not, then the measure Beginning Value 3yr = CALCULATE(SUM('Table'[AUM]),FILTER('Table','Table'
If issue persists, please share some sample data and expected results about the Beginning Value 3yr for our analysis.
Best Regards,
Qiuyun Yu
Hi Quiyun,
So if I create a measure
Beginning Date Measure = date(year(max('Table'[Year]))-3,12,31)
then
BeginValueMeasure = CALCULATE(sum('Table'[AUM]),filter('Table','Table'[Year]='Table'[Beginning Date Measure]))
Returns a blank.
However, if I create a column
Beg Date Col = date(year(max('Table'[Year]))-3,12,31)
then
Begin Value = CALCULATE(sum('Table'[AUM]),filter('Table','Table'[Year]='Table'[Beg Date Col]))
returns the correct value.
New to DAX, so I'm not sure why the measure didn't work. I'm interested in finding out the reasoning for intellectual reasons, but the work issue has been resolved. Thanks for your help.
Raghu
- v-qiuyu-msft9 years ago
Community Support
Hi Anonymous,
Glad to hear that the issue has been solved.
In my opinion, the calculated column Beg Date Col will return values based on each year value in the table. While the Beginning Date Measure will return date based on the visual context to calculate Max(Year) then return the value. This should be the difference. For more information, you can learn measures and calculated columns below:
Tutorial: Create your own measures in Power BI Desktop
Tutorial: Create calculated columns in Power BI Desktop
Best Regards,
Qiuyun Yu