Forum Discussion
Measure with time intelligence
- Anonymous2 years ago
Hi drivero ,
Here's a revised approach to your problem:
-
Refine Conditional Logic: Ensure that your conditional logic accurately reflects the transition between and . It's crucial that the condition checks not only the month but also aligns with your YTD calculation requirements.
MB_LitrosNAVMB_LitrosD365 -
Adjust YTD Calculation: For the YTD calculation that includes December, you might need to explicitly define the accumulation of from January to November and then add for December. This might involve a more complex DAX formula that conditionally sums these measures based on the date range.
MB_LitrosNAVMB_LitrosD365 -
Example Revised Formula:
VAR CurrentYear = YEAR(MAX('DWH DimDate'[Date])) VAR StartOfYear = DATE(CurrentYear, 1, 1) VAR EndOfNovember = DATE(CurrentYear, 11, 30) VAR DecemberData = IF(MONTH(MAX('DWH DimDate'[Date])) = 12, MB_LitrosD365, 0) VAR YTDExcludingDecember = CALCULATE([MB_LitrosNAV], DATESBETWEEN('DWH DimDate'[Date], StartOfYear, EndOfNovember)) RETURN IF(MONTH(MAX('DWH DimDate'[Date])) = 12, YTDExcludingDecember + DecemberData, [MB_LitrosNAV])Best Regards,
Xianda Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
-
Hi drivero ,
Here's a revised approach to your problem:
-
Refine Conditional Logic: Ensure that your conditional logic accurately reflects the transition between and . It's crucial that the condition checks not only the month but also aligns with your YTD calculation requirements.
MB_LitrosNAVMB_LitrosD365 -
Adjust YTD Calculation: For the YTD calculation that includes December, you might need to explicitly define the accumulation of from January to November and then add for December. This might involve a more complex DAX formula that conditionally sums these measures based on the date range.
MB_LitrosNAVMB_LitrosD365 -
Example Revised Formula:
VAR CurrentYear = YEAR(MAX('DWH DimDate'[Date]))
VAR StartOfYear = DATE(CurrentYear, 1, 1)
VAR EndOfNovember = DATE(CurrentYear, 11, 30)
VAR DecemberData = IF(MONTH(MAX('DWH DimDate'[Date])) = 12, MB_LitrosD365, 0)
VAR YTDExcludingDecember = CALCULATE([MB_LitrosNAV], DATESBETWEEN('DWH DimDate'[Date], StartOfYear, EndOfNovember))
RETURN IF(MONTH(MAX('DWH DimDate'[Date])) = 12, YTDExcludingDecember + DecemberData, [MB_LitrosNAV])
Best Regards,
Xianda Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.