Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Cummulative measure

Hello commulative    I need to create a cummulative measure for how long have clients been with us. Any ideas in how I can do these?   The second question I have is that our financial year does n...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Anonymous ,

     

    Please follow these steps:

    1.Regarding the calculation of the time spent with the client, you can create measure and write the following dax expression:

    Years of cooperation = YEAR(TODAY()) - MAX('Table'[Date_Became_Client])

    Create the measure and calculate the cumulative value:

    cummulate = 
    SUMX(FILTER(ALL('Table'),'Table'[Date_Became_Client] >= MAX('Table'[Date_Became_Client])),'Table'[Years of cooperation])

    2.Regarding the mismatch between the two dates, I created the Date_Became_Client group based on your screenshot and found that its data type is text, the reason for the mismatch between the fiscal year and the calendar year may be a data type problem, at this time it will show the error as shown in the figure below.

    A text string representing a number can be converted to a number using VALUE. Similar to VALUE(MAX('Table'[Date_Became_Client (bins)])), you can refer to the documentation for more information about the value function: VALUE function (DAX) - DAX | Microsoft Learn.

     

    If your Current Period does not refer to this, please clarify in a follow-up reply.

     

    Best Regards,

    Clara Gong

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.