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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
wasirafi
Helper I
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

https://1drv.ms/x/s!AjIGh95acxebg6MRIvZG56trS7ljtQ?e=DVd8tT 

Attached Pbix.

https://1drv.ms/u/s!AjIGh95acxebg6MQyLee1C3MHik0MA?e=3WgSIw heatmap pic.PNG

 

1 ACCEPTED SOLUTION
wini_R
Resolver II
Resolver II

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)

View solution in original post

4 REPLIES 4
wini_R
Resolver II
Resolver II

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)

Hey Wini_R.

 

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

 

lbendlin
Super User
Super User

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

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. 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.