Forum Discussion

drivero's avatar
drivero
Helper I
2 years ago
Solved

Measure with time intelligence

Dear all,   I have a problem with some data in my power bi model. I am using AS with a tabular model .bim   I have the 'DWH DimDate'[Date] as calendar I have as well Time Intellegince with 2 opt...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi drivero ,

    Here's a revised approach to your problem:

    1. 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

    2. 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

    3. 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.