Dave Ward
Dave Ward

Reputation: 107

Power BI: Multiply by each point between two values. (Calculate Curve)

I'm working with a dataset where I have a Min Value and a Max value and then a sales value.

If the Min value = 100, the max value = 110 and the Sales value equal to 10. Then I have to create a line chart which plots the output of each number between the min and max multiplied by the sales value.

Which looks like below

Which looks like below

The goal is to create a line like below

Which in turn generates a line such as the below

Is there a way of doing this In Power BI via Dax as I am currently creating a mart table with a cursor for each record in the table containing the initial rows which is getting quite large?

Upvotes: 1

Views: 163

Answers (1)

OscarLar
OscarLar

Reputation: 1335

You can create a (calculated) table like this:

Expanded_Data = 
GENERATE(
    'RawData';
    SELECTCOLUMNS(
        var maxMinusMin = [Max]-[Min]
        return
        GENERATESERIES(
            [Min]*maxMinusMin;
            [Max]*maxMinusMin;
            maxMinusMin
        );
        "Plot_Point"; [Value]
    )
)

Where 'RawData' is the table name which has at least two columns named [Max] and [Min] : enter image description here1

In this way you don't need the sales value info. Just substitute the variable for the sales value column

Upvotes: 3

Related Questions