1
votes

I would like to simulate results of function (DAX measure or calculated column) for different values of input. Let's assume we want to calculate rectangle area (function) for different values of its sides. The common use of this is when we want to calculate value of function for different scenarios of X variable.

[area] = a * b

Sample data:

a_side =
DATATABLE (
    "a", INTEGER,
    {
        { 0 },
        { 1 },
        { 2 },
        { 3 }
    }
)
b_side =
DATATABLE (
    "b", INTEGER,
    {
        { 0 },
        { 1 },
        { 2 },
        { 3 }
    }
)

I add a_side[a] and b_side[b] columns to matrix and get this error:

Can't determine relationship between the fields Can't display data because Power BI can't determine the relationship between two or more fields

enter image description here

I want to get this expected result:

enter image description here

1

1 Answers

2
votes

I think it just needs a measure to work because it doesn't know what values to put into the cells.

RectangleArea = SELECTEDVALUE ( a_side[a] ) * SELECTEDVALUE ( b_side[b] )

Matrix Visual

Without the measure:

Error Message