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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
nor303
Helper III
Helper III

create custom column in Powerbi desktop with intervalls - power query

Hi 

 

Im having troubles computing a custom column from the following data

CustLoanValueIntervall
15110-50%
2101250-100%
310Blank
475Above 100%

 

New Column = Loan/Value = Blank - Intervall (0-50% or 50-100% or Above 100%) 

 

I got an infinity problem. Ive tried to use both DIVIDE and IF etc in power query but it seems like its not supported.

 

 

1 REPLY 1
lbendlin
Super User
Super User

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTIFYkNDpVidaCUjENMARBiB+cYgJhAbgHkmQJY5WENsLAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Cust = _t, Loan = _t, Value = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Loan", type number}, {"Value", type number}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Interval", each if [Value]=0 then null else 
if [Loan]/[Value]<= 0.5 then "0-50%" else
if [Loan]/[Value]<= 1 then "50-100%" else
"Above 100%")
in
    #"Added Custom"

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".

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.