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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
mt_729
Regular Visitor

Create a table based on two values with increments in Power Query

Hello,

 

I'm trying to create a dynamic table which will receive an input for minimum and maximum targets. The query should then add rows with 0.1 increments.

What I find difficult is that a column called "Payout" should correspond to the minimum Target and calculate increments until the maximum payout.

 

I've added a screenshot so it's easier to visualise. Basically, my inputs are the table below:

mt_729_0-1707803595975.png

 

It should calculate the increment, (in this case, 1.5%) and create a column like this:

 

mt_729_3-1707803726766.png

 

 

Note that past 98%, the payout is capped at 120%, as this represents the max.

 

1 ACCEPTED SOLUTION
AlienSx
Super User
Super User

hello, @mt_729 

let
    Source = your_table,
    gen = List.Generate(
        () => [Target = Source{[Type = "Minimum"]}[Target], Payout = Source{[Type = "Minimum"]}[Payout]],
        (x) => x[Target] <= Source{[Type = "Maximum"]}[Target],
        (x) => [Target = x[Target] + .001, Payout = List.Min({Source{[Type = "Maximum"]}[Payout], x[Payout] + .015})]
    ),
    z = Table.FromRecords(gen)
in
    z

View solution in original post

2 REPLIES 2
AlienSx
Super User
Super User

hello, @mt_729 

let
    Source = your_table,
    gen = List.Generate(
        () => [Target = Source{[Type = "Minimum"]}[Target], Payout = Source{[Type = "Minimum"]}[Payout]],
        (x) => x[Target] <= Source{[Type = "Maximum"]}[Target],
        (x) => [Target = x[Target] + .001, Payout = List.Min({Source{[Type = "Maximum"]}[Payout], x[Payout] + .015})]
    ),
    z = Table.FromRecords(gen)
in
    z
rubayatyasmin
Community Champion
Community Champion

Hi, @mt_729 

 

First, you need to create a basic table with your minimum and maximum target values. You can enter these directly in Power BI using "Enter Data" from the Home ribbon or import them from an external source. (I am guessing you have one already)

 

* create a calculated table

 

TargetTable =
VAR MinTarget = 95.0
VAR MaxTarget = 98.0
VAR TargetIncrement = 0.1
VAR MinPayout = 75
VAR PayoutIncrement = 1.5
VAR MaxPayout = 120
RETURN
GENERATESERIES(MinTarget, MaxTarget, TargetIncrement)

 

this dax will create a single column table with values from 95.0 to 98.0 incremented by 0.1.

 

Now add a calculated column in your newly created TargetTable

 

Payout =
VAR BasePayout = [Target] - 95.0
RETURN
IF(
[Target] <= 98.0,
MIN(MinPayout + (BasePayout * (PayoutIncrement / TargetIncrement)), MaxPayout),
MaxPayout
)

 

Replace [Target] with the actual column name that contains the target values.

 

 


Did I answer your question? Mark my post as a solution!super-user-logo

Proud to be a Super User!


Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors