Reputation: 107
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
The goal is to create a line like 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
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]
:
1
In this way you don't need the sales value info. Just substitute the variable for the sales value column
Upvotes: 3