Forum Discussion

Naveen_SV's avatar
Naveen_SV
Icon for Helper IV rankHelper IV
4 years ago
Solved

How to write a Dax for after half year adding value based on 6th month

Hi Team,   I have a requirement first half of the year my cost will remain same, but later secound half of the year my cost should add 6th month cost.   Ex :       month           Cost          ...
  • Naveen_SV's avatar
    Naveen_SV
    4 years ago

    Hi Amit,

     

    I tried with both like creating Measure and column also but i am getting same error.

     

    new column =
    VAR _cost =
    MAXX ( FILTER ( 'Table', 'Table'[Month] = 6 ), 'Table'[Total Cost] )
    RETURN
    IF ( 'Table'[Month] > 6, _cost + 'Table'[Total Cost] )
     
    with measure
    new measure =
    VAR _cost =
    MAXX ( FILTER ( 'Table', 'Table'[Month] = 6 ), 'Table'[Total Cost] )
    RETURN
    IF ( FILTER ( 'Table', 'Table'[Month] = 6 ), _cost, 'Table'[Total Cost] )
     
  • v-jingzhang's avatar
    4 years ago

    Hi Naveen_SV 

     

    Please create a new column with below code. PBIX is attached. 

    new cost = 
    IF (
        'Table'[Month] > 6,
        MAXX ( FILTER ( 'Table', 'Table'[Month] = 6 ), 'Table'[Cost] ) + 'Table'[Cost],
        'Table'[Cost]
    )

     

    Best Regards,
    Community Support Team _ Jing
    If this post helps, please Accept it as Solution to help other members find it.