Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.
Hi
Need assistance I am trying to find the Max based on another column although I want the values to be summed depending on the depots filtered.
Example Data
Depot | Date | Time | Value 1 | Value 2 |
CAL | 18-Aug | 10:00AM | 10 | 0 |
CAL | 18-Aug | 11:00AM | 10 | 1 |
CAL | 18-Aug | 12:00PM | 20 | 2 |
CAL | 18-Aug | 1:00PM | 20 | 9 |
CAL | 18-Aug | 2:00PM | 15 | 3 |
MARC | 18-Aug | 10:00AM | 11 | 3 |
MARC | 18-Aug | 11:00AM | 15 | 4 |
MARC | 18-Aug | 12:00PM | 21 | 1 |
MARC | 18-Aug | 1:00PM | 21 | 7 |
MARC | 18-Aug | 2:00PM | 3 | 8 |
CAL | 19-Aug | 10:00AM | 10 | 2 |
CAL | 19-Aug | 11:00AM | 10 | 4 |
CAL | 19-Aug | 12:00PM | 20 | 1 |
CAL | 19-Aug | 1:00PM | 20 | 8 |
CAL | 19-Aug | 2:00PM | 15 | 3 |
MARC | 19-Aug | 10:00AM | 11 | 2 |
MARC | 19-Aug | 11:00AM | 15 | 1 |
MARC | 19-Aug | 12:00PM | 21 | 2 |
MARC | 19-Aug | 1:00PM | 21 | 5 |
MARC | 19-Aug | 2:00PM | 3 | 0 |
At a total level return Value 2 based on the Max Value 1. These Values should be summed if multiple depots are filtered.
What I am trying to acheive in a matrix with a depot filter
Date | Time | Value 1 | Value 2 | |
18-Aug | 10:00AM | 21 | 3 | |
18-Aug | 11:00AM | 25 | 5 | |
18-Aug | 12:00PM | 41 | 3 | |
18-Aug | 1:00PM | 41 | 16 | |
18-Aug | 2:00PM | 18 | 11 | |
Total | 18-Aug | 41 | 16 | |
19-Aug | 10:00AM | 21 | 4 | |
19-Aug | 11:00AM | 25 | 5 | |
19-Aug | 12:00PM | 41 | 3 | |
19-Aug | 1:00PM | 41 | 13 | |
19-Aug | 2:00PM | 18 | 3 | |
Total | 19-Aug | 41 | 13 |
Solved! Go to Solution.
@LLP515 , First create a measure for MAX Value 1
Proud to be a Super User! |
|
Hi @LLP515 ,
Thanks bhanu_gautam for the quick reply. I have some other thoughts to add:
(1)We can create measures.
Measure1 = CALCULATE(SUM('Table'[Value 1]),FILTER(ALLSELECTED('Table'),[Date ] in VALUES('Table'[Date ]) && [Time] in VALUES('Table'[Time])))
Value1 =
var _a=CALCULATE(SUM('Table'[Value 1]),FILTER(ALLSELECTED('Table'),[Date ] in VALUES('Table'[Date ]) && [Time] in VALUES('Table'[Time])))
var _b=MAXX(FILTER(ALLSELECTED('Table'),[Date ] in VALUES('Table'[Date ]) && [Time] in VALUES('Table'[Time])),[Measure1])
var _c=IF(ISINSCOPE('Table'[Time])=FALSE(),_b,_a)
RETURN _c
Value2 =
var _a=SUM('Table'[Value 2])
var _max=MAXX(FILTER(ALLSELECTED('Table'),[Date ] in VALUES('Table'[Date ]) && [Time] in VALUES('Table'[Time])),[Measure1])
var _b=CALCULATE(MAX('Table'[Time]),FILTER(ALLSELECTED('Table'),[Time] in VALUES('Table'[Time]) && [Date ] in VALUES('Table'[Date ]) && [Measure1]=_max))
var _f=CALCULATE(SUM('Table'[Value 2]),FILTER(ALLSELECTED('Table'),[Date ] in VALUES('Table'[Date ]) && [Time] = _b))
RETURN IF(ISINSCOPE('Table'[Time])=FALSE(),_f,_a)
(2) Then the result is as follows.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @LLP515 ,
Thanks bhanu_gautam for the quick reply. I have some other thoughts to add:
(1)We can create measures.
Measure1 = CALCULATE(SUM('Table'[Value 1]),FILTER(ALLSELECTED('Table'),[Date ] in VALUES('Table'[Date ]) && [Time] in VALUES('Table'[Time])))
Value1 =
var _a=CALCULATE(SUM('Table'[Value 1]),FILTER(ALLSELECTED('Table'),[Date ] in VALUES('Table'[Date ]) && [Time] in VALUES('Table'[Time])))
var _b=MAXX(FILTER(ALLSELECTED('Table'),[Date ] in VALUES('Table'[Date ]) && [Time] in VALUES('Table'[Time])),[Measure1])
var _c=IF(ISINSCOPE('Table'[Time])=FALSE(),_b,_a)
RETURN _c
Value2 =
var _a=SUM('Table'[Value 2])
var _max=MAXX(FILTER(ALLSELECTED('Table'),[Date ] in VALUES('Table'[Date ]) && [Time] in VALUES('Table'[Time])),[Measure1])
var _b=CALCULATE(MAX('Table'[Time]),FILTER(ALLSELECTED('Table'),[Time] in VALUES('Table'[Time]) && [Date ] in VALUES('Table'[Date ]) && [Measure1]=_max))
var _f=CALCULATE(SUM('Table'[Value 2]),FILTER(ALLSELECTED('Table'),[Date ] in VALUES('Table'[Date ]) && [Time] = _b))
RETURN IF(ISINSCOPE('Table'[Time])=FALSE(),_f,_a)
(2) Then the result is as follows.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you! @Anonymous
@LLP515 , First create a measure for MAX Value 1
Proud to be a Super User! |
|
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
6 | |
4 | |
3 | |
3 |
User | Count |
---|---|
13 | |
11 | |
8 | |
8 | |
8 |