Forum Discussion

aatish178's avatar
aatish178
Icon for Helper IV rankHelper IV
2 years ago
Solved

subtracting previous row value from current row dynamically in Table visual

quantumudit Hi Udit,I have a below dataset:   FY StudentID StudentName Gender Status ClassDivision FY19 11 palash M Absent DIV A FY19 12 akash M Absent DIV A FY19 13 vi...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi aatish178 

     

    First, we need to ensure we have a measure that calculates the total count of StudentID for each FY.

    Total Students = COUNT('Table'[StudentID])

     

    Next, we'll create a measure that calculates the difference in the count of StudentID between each FY and the previous FY.

    Difference = 
    VAR CurrentFY = MAX('Table'[FY])
    VAR PreviousFY = CurrentFY - 1
    VAR CurrentFYCount = CALCULATE([Total Students], 'Table'[FY] = CurrentFY)
    VAR PreviousFYCount = CALCULATE([Total Students], 'Table'[FY] = PreviousFY)
    RETURN CurrentFYCount - PreviousFYCount
    % = 
    VAR CurrentFY = MAX('Table'[FY])
    VAR PreviousFY = CurrentFY - 1
    VAR CurrentFYCount = CALCULATE([Total Students], 'Table'[FY] = CurrentFY)
    VAR PreviousFYCount = CALCULATE([Total Students], 'Table'[FY] = PreviousFY)
    RETURN (CurrentFYCount - PreviousFYCount)/PreviousFYCount

     

     

    This is the result you want:


     

     

    Best Regards,

    Jayleny

     

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