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

View all the Fabric Data Days sessions on demand. View schedule

Reply
Bokchoy
Helper II
Helper II

look up value within temporary groupby table

Hi all,

 

I have a temp table that sums up total_charge, grouped by single_date. Now i want to return the date where the highest "sum all charge" was hit.

im having troubles with referencing the "Date" column within my temp table and im unable to complete the measure.

Please help, thanks.

 

Highest Daily_date=

var temp1 =  GROUPBY(Jobs, Jobs[job_date] , "Sum all Charge", SUMX(CURRENTGROUP(), Jobs[total_charge]))

var maxcharge_date = "                               " 

return maxcharge_date

 

1 ACCEPTED SOLUTION

@Bokchoy 

is this what you want?

maxdate = 
VAR tbl=SUMMARIZE(sample_jobs,sample_jobs[job_date],"charge",sum(sample_jobs[total_charge]))
VAR _max= maxx(tbl,[charge])
return maxx(FILTER(tbl,[charge]=_max),'sample_jobs'[job_date])

month = FORMAT([maxdate],"mmm")

111.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

6 REPLIES 6
Bokchoy
Helper II
Helper II

Hi Ryan,

 

Thanks for looking into this, not sure if I explained it correctly.

I made a simple data set below.
https://drive.google.com/file/d/14MBKPOsPqzPb5mFZBV0LOBS56yE_0RtX/view?usp=sharing



Bokchoy
Helper II
Helper II

Hi Ryan,

 

Thanks for looking into this, not sure if I explained it correctly.

I made a simple data set below.
https://drive.google.com/file/d/14MBKPOsPqzPb5mFZBV0LOBS56yE_0RtX/view?usp=sharing



@Bokchoy 

is this what you want?

maxdate = 
VAR tbl=SUMMARIZE(sample_jobs,sample_jobs[job_date],"charge",sum(sample_jobs[total_charge]))
VAR _max= maxx(tbl,[charge])
return maxx(FILTER(tbl,[charge]=_max),'sample_jobs'[job_date])

month = FORMAT([maxdate],"mmm")

111.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi ryan,

thanks for helping!

i was able to get what i needed from your code, though i used the Groupby function instead of summarize. The return maxx line was that i was looking for. 

again thanks heaps.

Record Daily date = 

#maxdate = 
#VAR tbl=SUMMARIZE(jobs,Jobs[job_date],"charge",sum(jobs[total_charge]))
#VAR _max= maxx(tbl,[charge])
#return maxx(FILTER(tbl,[charge]=_max),Jobs[job_date])

var temp1 = GROUPBY(Jobs, Jobs[job_date] , "Sum all Charge", SUMX(CURRENTGROUP(), Jobs[total_charge]))
var High_Daily = MAXX(temp1, [Sum all Charge])
var date_ = MAXX(FILTER(temp1, [Sum all Charge] = High_Daily), Jobs[job_date])

return date_




you are welcome





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




ryan_mayu
Super User
Super User

@Bokchoy 

could you pls proivde the sample data and expected output?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors