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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Using minimum function after aggregation

Hi all. 

 

I am trying to apply a minimum function after aggregation. Meaning that PBI should not look in raw data for the minimum, but instead it should find the minimum after aggregation.

 

My minimum function is conditional. It is about finding the "point 0" for a time series (paybacktime).

 

It would seem that this is a relative frequent occuring task, so wondering if someone have a nice recipe for this? 🙂

 

Best Regards,

Torben

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Does that mean you want to group data till a level and take min

minx(summarize(Table, Table[Group], "_1",sum(Table[Value])),[_1])

 

You can more than one group like Table[Group], Table[Group1] etc

 

Another way

https://community.powerbi.com/t5/Desktop/SUM-of-AVERAGE/td-p/197013

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

7 REPLIES 7
amitchandak
Super User
Super User

@Anonymous , Does that mean you want to group data till a level and take min

minx(summarize(Table, Table[Group], "_1",sum(Table[Value])),[_1])

 

You can more than one group like Table[Group], Table[Group1] etc

 

Another way

https://community.powerbi.com/t5/Desktop/SUM-of-AVERAGE/td-p/197013

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Exactly! Except that the "summarize" part should be dynamic. We have lot's of users on an Excel-connection that will aggregate data in all kind of ways. 

 

Btw: i haven't examined how these kind of functions works in an Excel-connection. 

Hi @Anonymous ,

 

First go to query editor>select column 000,001,002,003>choose "unpivot columns";

Then create 2 measures as below:

 

_total = SUMX(FILTER(ALL('Table (2)'),'Table (2)'[Attribute]=MAX('Table (2)'[Attribute])&&'Table (2)'[Country]=MAX('Table'[Country])),'Table (2)'[Value])
payback periods = 
var a=MINX(FILTER(ALL('Table (2)'),'Table (2)'[_total]>0),'Table (2)'[_total])
Return
CALCULATE(MAX('Table (2)'[Attribute]),FILTER('Table (2)','Table (2)'[_total]=a))

 

Finally you will see:

Annotation 2020-06-09 160943.png

For the related .pbix file, pls click here.

 


Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

 

Anonymous
Not applicable

Im getting an error message when opening the pbix file: 

pbiversion.PNG

Im using may-2020 version of PBI.

 

Anyhow, I will try out your formulas provided 🙂

Hi @Anonymous 

 

Try installing power bi again.

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

Not sure if understand the requirement, it would be a lot easier if you would provide a data sample, explain your scenario and provide an expected outcome.

 

but you can try to use MAXX aggregating over an attribute, like for example.

 

max sales by color = MAXX( VALUES( table[color] ), CALCULATE( SUM( table[sales amt] ) ) )

 

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Anonymous
Not applicable

Thanks for your input.
Here is a visualization of my problem, hope it's helpful. 

 

Top table: here is my raw data, split by country and device. The columns "000", "001", .. represent the accumulated customer value.

Middle table: a PBI user have aggregated the values on country, perhaps in a excel connection. 

Bottom table: this is the output im looking for (it does not need to show the relative month, just the break-even month).

 

I tried the following: payback_month = CALCULATE(MIN(table[relative_month]),cashflow[value_acc] > 0). 

This returns the minimum value, but for the raw/non-aggregated data! 

 

relative_month.PNG

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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