Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
hosea_chumba
Helper I
Helper I

Percentage change analysis per item

Take the example below, how do i compute the percentage change of client loan amount for each client ID from one cycle of loan to the next cycle.

Client IDCycle of loanLoan Amount
X1             200
X2             450
R1       20,000
R2          4,500
R3       34,000
2 ACCEPTED SOLUTIONS
lbendlin
Super User
Super User

v-zhangti
Community Support
Community Support

Hi, @hosea_chumba 

 

You can try the following methods.
Measure:

Previous Amount = 
VAR _N1 = MAXX (FILTER (ALL ( 'Table' ),
            [Cycle of loan] < SELECTEDVALUE ( 'Table'[Cycle of loan] )
                && [Client ID] = SELECTEDVALUE ( 'Table'[Client ID] )
        ),[Cycle of loan])
Var _N2=CALCULATE (SUM ( 'Table'[Loan Amount] ),
        FILTER (ALL ( 'Table' ),
            [Client ID] = SELECTEDVALUE ( 'Table'[Client ID] )
                && [Cycle of loan] = _N1))
Return
IF(_N2=BLANK(),0,_N2)
Measure = 
IF ([Previous Amount] = BLANK (),BLANK (),
    DIVIDE ([Previous Amount] - SUM ( 'Table'[Loan Amount] ),SUM ( 'Table'[Loan Amount] )))

vzhangti_0-1669604844623.png

Is this the result you expect?

Best Regards,

Community Support Team _Charlotte

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

View solution in original post

2 REPLIES 2
v-zhangti
Community Support
Community Support

Hi, @hosea_chumba 

 

You can try the following methods.
Measure:

Previous Amount = 
VAR _N1 = MAXX (FILTER (ALL ( 'Table' ),
            [Cycle of loan] < SELECTEDVALUE ( 'Table'[Cycle of loan] )
                && [Client ID] = SELECTEDVALUE ( 'Table'[Client ID] )
        ),[Cycle of loan])
Var _N2=CALCULATE (SUM ( 'Table'[Loan Amount] ),
        FILTER (ALL ( 'Table' ),
            [Client ID] = SELECTEDVALUE ( 'Table'[Client ID] )
                && [Cycle of loan] = _N1))
Return
IF(_N2=BLANK(),0,_N2)
Measure = 
IF ([Previous Amount] = BLANK (),BLANK (),
    DIVIDE ([Previous Amount] - SUM ( 'Table'[Loan Amount] ),SUM ( 'Table'[Loan Amount] )))

vzhangti_0-1669604844623.png

Is this the result you expect?

Best Regards,

Community Support Team _Charlotte

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

lbendlin
Super User
Super User

lbendlin_0-1669567375142.png

 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors