cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Helper I

## Calculate sum for a measure from another table.

Hello PB Community and super guru's i,e @Ahmedx , @lbendlin

I need 1 DAX / Measure to achieve the following

1. find the Min value from an existing measure (Actual Avg TMAX RZ)

2. find the Max value from an existing measure (Actual Avg TMAX RZ)

3. Difference between Max and Min from point 1 & 2

4. Multiply the Difference (from point 3) by the measure (Total Run time) filtering by values from 1.

Excel File

Attached Pbix.

1 ACCEPTED SOLUTION
Resolver III

HI @wasirafi,

I do't understand why max = 480 and not 481 but if that is a mistake you might try with the following measure:

``````_result =
VAR _min =
CALCULATE(
MIN(v_run[Actual Avg TMAX RZ]),
ALL(v_run[Actual Avg TMAX RZ])
)
VAR _max =
CALCULATE(
MAX(v_run[Actual Avg TMAX RZ]),
ALL(v_run[Actual Avg TMAX RZ])
)
VAR _runTime =
CALCULATE(
[_Total Run Time],
v_run[Actual Avg TMAX RZ] = _min
)
RETURN _runTime * (_max - _min)``````
4 REPLIES 4
Resolver III

HI @wasirafi,

I do't understand why max = 480 and not 481 but if that is a mistake you might try with the following measure:

``````_result =
VAR _min =
CALCULATE(
MIN(v_run[Actual Avg TMAX RZ]),
ALL(v_run[Actual Avg TMAX RZ])
)
VAR _max =
CALCULATE(
MAX(v_run[Actual Avg TMAX RZ]),
ALL(v_run[Actual Avg TMAX RZ])
)
VAR _runTime =
CALCULATE(
[_Total Run Time],
v_run[Actual Avg TMAX RZ] = _min
)
RETURN _runTime * (_max - _min)``````
Helper I

Hey Wini_R.

Yes that was a typo. the DAX worked exactly as i wanted. Thank you

Super User

You cannot measure a measure directly. Either materialize it first, or create a separate measure that implements the entire business logic.

Helper I

Ibendlin,

Yes you are right. i am requesting only 1 measure that applies this entire logic. I called them out as measures just for the sake to notify the basic level of efforts i have done so far.

Announcements

#### New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

#### Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

#### Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors