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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Darwinm
Frequent Visitor

Need help with creating a measure to calculate roll rate % of delinquent accounts

Hi folks, 

I am currently stuck in a situation where I am trying to calculate the roll rate % of delinquent accounts in Power BI. I have delinquency listed out in catergories: 1-30, 31-60, 61-90, 90+ and so on along with dates. I want to create a measure which would return the Roll Rate % value for each category (1-30, 31-60, 61-90, 90+ and so on) based on the amounts. I was able to calculate them in Excel and have tried several measures in Power BI but no luck.

For instance, to calculate 1-30 roll rate%: I divided 1-30 amount of current month by Current amount of previous month. Please refer to the screenshots to see the sample calculation. 

Also, I am attaching a table with sample dataset for reference. I would highly appreciate any kind of assistance with this. 

Thank you in advance! 



Calculation SS1.pngCalculation SS2.png

DateCurrent1-301-30 Roll rate %31-6031-60 Roll rate %61-9061-90 Roll rate %91+ 91+ roll rate %
2019-01-315700069000 124374 38732 8686 
2019-02-281000004500079%39848355775%2354619%54366140%
2019-03-31157000800000800%48757108%557651%67676287%
2019-04-30400700700000446%56453571%323423663%77667139%
2019-05-31500900478096119%424546%57657561021%65672%
2019-06-3080070034545369%46456797%45344107%74550%
2019-07-319001002335346292%78768762280%76872%67765149%
2019-08-31100140025356428%55546624%6656778%56363733%
2019-09-30112000023355323%67676872669%425468%7656712%




2 ACCEPTED SOLUTIONS
lbendlin
Super User
Super User

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("VZFZjoNADETvwneQ3C5vfZYo97/GeIEJEUhuNX6uKvN+H0xrn7ROrON1qBNRVttTFwtc8oBwcNawsOPzujE+OaqNaPpFp2KHBDRPDBWryQJ7khjBdSvG/4hw9QLUrQaY5/MA5US3EXn3+w2qibYkGMKoT27mD1SvkER7pDxolzlhUen4pq51Y/pD2ojGLYrs15KQFDXv5JAa4aL6AH0kU281yEA2loKHW751ytpBK/AXjWtDicqwGc/apuZO22XZ7GUZDA92j9+1+FpO6bbhXmfrCc+f8cn6+QM=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, Current = _t, #"1-30" = _t, #"31-60" = _t, #"61-90" = _t, #"91+ " = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Current", type number}, {"1-30", type number}, {"31-60", type number}, {"61-90", type number}, {"91+ ", type number}}),
    #"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 0, 1, Int64.Type),
    #"Added Custom" = Table.AddColumn(#"Added Index", "1-30 %", each try [#"1-30"]/#"Changed Type"[Current]{[Index]-1} otherwise null),
    #"Added Custom1" = Table.AddColumn(#"Added Custom", "31-60 %", each try [#"31-60"]/#"Changed Type"[#"1-30"]{[Index]-1} otherwise null),
    #"Added Custom2" = Table.AddColumn(#"Added Custom1", "61-90 %", each try [#"61-90"]/#"Changed Type"[#"31-60"]{[Index]-1} otherwise null),
    #"Added Custom3" = Table.AddColumn(#"Added Custom2", "91+ %", each try [#"91+ "]/#"Changed Type"[#"61-90"]{[Index]-1} otherwise null),
    #"Changed Type1" = Table.TransformColumnTypes(#"Added Custom3",{{"1-30 %", Percentage.Type}, {"31-60 %", Percentage.Type}, {"61-90 %", Percentage.Type}, {"91+ %", Percentage.Type}})
in
    #"Changed Type1"

How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done".

View solution in original post

Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

11 REPLIES 11
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi Ashish,

Am not able to download the link to view the calculation of roll rates%.

would you be able to copy and paste here so i can replicate in Power Bi to understand the logic.thank you

Hi,

I do not have that file.  Share some data, explain the question and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

thanks Ashish for quick reply.

Basically i am trying to replicate excel reports to Power BI.

Need help in the logic to create Flow rates on 12 months data.

Below is the sample snap shot for a month..

Bucket31/05/202430/06/2024 
0 $           272,636,283 $   405,451,761 
1 $             45,069,853 $      94,650,236 
2 $               2,194,434 $        4,113,874 
3 $               3,182,276 $            804,972 
4 $               4,562,202 $            329,291 
5 $                   772,963 $            752,025 
6 $                   484,132 $            231,041 
 Flow rates30/06/2024Formuale
 M1:  1 - 2935%junbucket1/maybucket0
 M2: 30 - 599%junbucket2/maybucket1
 M3: 60 - 8937%junbucket3/maybucket2
 M4: 90 - 11910%junbucket4/maybucket3
 M5:120 - 14916%junbucket5/maybucket4
 M6:150 - 17930%junbucket6/maybucket5
 

From your screen shot..i need the formuale that used to calculate 30+Roll rate,60+Roll rate., etc.,

 

Hope its clear.thank you

 

Hi Ashish, 

Thank you so much for providing guidance. I tried this and it worked just fine :). However, I want the values to change accordingly to the filters ( such as Lending partners, Provinces, etc.) I choose, is there a solution to make it dynamic according to the chosen filters? For instance, in excel I had applied filters in the pivot table and when I selected different dropdown options through filters, the output value changed accordingly. 

Highly appreciate your assistance! 
Thank you! 

"However, I want the values to change accordingly to the filters ( such as Lending partners, Provinces, etc.) "

 

Please provide sanitized sample data that fully covers your issue.


Actually, never mind I finally figured it out. Utilized filter function to filter out each days_delq and calculate from there on. 

I am so thankful to both of you for providing guidance with my situation. Kudos! :))

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
lbendlin
Super User
Super User

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("VZFZjoNADETvwneQ3C5vfZYo97/GeIEJEUhuNX6uKvN+H0xrn7ROrON1qBNRVttTFwtc8oBwcNawsOPzujE+OaqNaPpFp2KHBDRPDBWryQJ7khjBdSvG/4hw9QLUrQaY5/MA5US3EXn3+w2qibYkGMKoT27mD1SvkER7pDxolzlhUen4pq51Y/pD2ojGLYrs15KQFDXv5JAa4aL6AH0kU281yEA2loKHW751ytpBK/AXjWtDicqwGc/apuZO22XZ7GUZDA92j9+1+FpO6bbhXmfrCc+f8cn6+QM=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, Current = _t, #"1-30" = _t, #"31-60" = _t, #"61-90" = _t, #"91+ " = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Current", type number}, {"1-30", type number}, {"31-60", type number}, {"61-90", type number}, {"91+ ", type number}}),
    #"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 0, 1, Int64.Type),
    #"Added Custom" = Table.AddColumn(#"Added Index", "1-30 %", each try [#"1-30"]/#"Changed Type"[Current]{[Index]-1} otherwise null),
    #"Added Custom1" = Table.AddColumn(#"Added Custom", "31-60 %", each try [#"31-60"]/#"Changed Type"[#"1-30"]{[Index]-1} otherwise null),
    #"Added Custom2" = Table.AddColumn(#"Added Custom1", "61-90 %", each try [#"61-90"]/#"Changed Type"[#"31-60"]{[Index]-1} otherwise null),
    #"Added Custom3" = Table.AddColumn(#"Added Custom2", "91+ %", each try [#"91+ "]/#"Changed Type"[#"61-90"]{[Index]-1} otherwise null),
    #"Changed Type1" = Table.TransformColumnTypes(#"Added Custom3",{{"1-30 %", Percentage.Type}, {"31-60 %", Percentage.Type}, {"61-90 %", Percentage.Type}, {"91+ %", Percentage.Type}})
in
    #"Changed Type1"

How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done".

Hi, 

First I would like to thank you for providing assitance in my case. 
When I tried to paste the above query, I was encounted with an error message. I am attaching a screenshot of the message. Also, my reference table is: 'Data' (seen in the screenshot), so I copied the source query from there and pasted it instead of " 

Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("VZFZjoNADETvwneQ3C5vfZYo97/GeIEJEUhuNX6uKvN+H0xrn7ROrON1qBNRVttTFwtc8oBwcNawsOPzujE+OaqNaPpFp2KHBDRPDBWryQJ7khjBdSvG/4hw9QLUrQaY5/MA5US3EXn3+w2qibYkGMKoT27mD1SvkER7pDxolzlhUen4pq51Y/pD2ojGLYrs15KQFDXv5JAa4aL6AH0kU281yEA2loKHW751ytpBK/AXjWtDicqwGc/apuZO22XZ7GUZDA92j9+1+FpO6bbhXmfrCc+f8cn6+QM=", BinaryEncoding.Base64), Compression.Deflate))

, do you think the source I put in is accurate? I would be very grateful to you if you could help me figure this out as I have been scratching my head with for days now. 
Thank you! Roll Rate error.png

In line 4 replace "Source" with "Data_Sheet"

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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