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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Calculate sum Max

Hello, Help me please,

I'd like to calculate the maximum values of a table by municipality and month, and then sum up the maximum values obtained.
The data is sorted by as shown in the image

Moiscommunedonnée
JanvierA5
JanvierB2
JanvierC3
FevrierA6
FevrierB8
FevrierC1
MarsA0
MarsB3
MarsC9
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @Anonymous 

According to your description, I created the following sample data and wrote a calculated column of DAX expressions based on these data:

vjianpengmsft_0-1708411866779.png

DAX formula:

Column =
VAR _name = 'Sheet4 (3)'[commune]
VAR _table =
    FILTER ( 'Sheet4 (3)', 'Sheet4 (3)'[commune] = _name )
RETURN
    CALCULATE ( MAXX ( _table, 'Sheet4 (3)'[donnée] ) )

The result is as follows:

vjianpengmsft_1-1708411987560.png

In the scenario of Commune A, the biggest value of finding each month is 6. I provided the pbix file used this time. If the above DAX can help you, it is great.

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

4 REPLIES 4
SamInogic
Super User
Super User

Hi @Anonymous ,

You need to create a calculated column to the maximum value for each municipality and month combination with below DAX expression,


MaxValue =

VAR CurrentCommune = Table1[commune]

VAR CurrentMonth = Table1[Mois]

RETURN

    CALCULATE(

        MAXX(

            FILTER(

                Table1,

                Table1[commune] = CurrentCommune && Table1[Mois] = CurrentMonth

            ),

            Table1[donnée]

        )

    )

 

Then create a measure that calculates the sum of the maximum values obtained for each municipality and month with below DAX expression:


TotalMaxValue = SUMX(Table1, Table1[MaxValue])


Thanks!

Inogic Professional Services

An expert technical extension for your techno-functional business needs

Power Platform/Dynamics 365 CRM

Drop an email at crm@inogic.com

Service:  http://www.inogic.com/services/ 

Power Platform/Dynamics 365 CRM Tips and Tricks:  http://www.inogic.com/blog/

Inogic Professional Services: Power Platform/Dynamics 365 CRM
An expert technical extension for your techno-functional business needs
Service: https://www.inogic.com/services/
Tips and Tricks: https://www.inogic.com/blog/
Anonymous
Not applicable

I want to do this:
Create a column that searches for maximum values by commune and month.
Then sum the maximums obtained.
If for a commune A I have in January 7, in February 2 and in March 6, the formula should look for the maximum of values for commune A per month. In this case, the new column should give 7. and so on until I have all the maximum data per commune and then add them together.

Anonymous
Not applicable

Hi, @Anonymous 

According to your description, I created the following sample data and wrote a calculated column of DAX expressions based on these data:

vjianpengmsft_0-1708411866779.png

DAX formula:

Column =
VAR _name = 'Sheet4 (3)'[commune]
VAR _table =
    FILTER ( 'Sheet4 (3)', 'Sheet4 (3)'[commune] = _name )
RETURN
    CALCULATE ( MAXX ( _table, 'Sheet4 (3)'[donnée] ) )

The result is as follows:

vjianpengmsft_1-1708411987560.png

In the scenario of Commune A, the biggest value of finding each month is 6. I provided the pbix file used this time. If the above DAX can help you, it is great.

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Anonymous
Not applicable

Hi @SamInogic 

Thanks for the suggestion, but I'm still not getting the desired result.
When I use the given syntax, I get the sum of all the data in the column.
Normally, with the data example, I'd get 23 as the result, but here I get 37.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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