Forum Discussion

pbijack93's avatar
pbijack93
Frequent Visitor
2 years ago
Solved

Measure Difference Between Cumulative Measure

I have created the following code             FTE_Prev_Mnth = CALCULATE( [FTE_Demand], PREVIOUSMONTH(Date_Dim[Date]) , Date_Dim[Date] <= MAX(Date_Dim[Date]) )           Whic...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi,pbijack93 

    Regarding the issue you raised, my solution is as follows:

    1.First I have created the following table and the column names and data are the data you have given:

    2. First of all, about your line value does not exist will not be counted, I recommend that you use the ISBLANK () function, his role is to first determine whether the value is empty, it is recommended that you can modify your measure to the following code:

    TE_Mnth_Var= 
    IF(
        ISBLANK([FTE_Prev_Mnth]),
        BLANK(),
        [FTE_Demand] - [FTE_Prev_Mnth]
    )
    

    Here is the relevant documentation:
    ISBLANK function (DAX) - DAX | Microsoft Learn

    3.Secondly, if you want to count the values in the date interval you set (the values come from a measure), you can also use the Sumx() function, here is the measure I created to meet your needs:

    Measure = SUMX('Date_Dim',CALCULATE([FTE_Mnth_Var],FILTER('Date_Dim','Date_Dim'[Date]>DATE(2024,6,1)&&'Date_Dim'[Date]<DATE(2025,3,1))))
    
    

    Here is the documentation for it:

    SUMX function (DAX) - DAX | Microsoft Learn

    Can you share sample data and sample output in tabular format if I am misunderstanding? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

    Best Regards,

    Leroy Lu

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