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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Group by order

I have a table looking like this: 

groupby.PNG

I would like to group all the orders and then have the max of precision per order.

Which mean I will get a report like this:

grouo1.PNG

How would you write such a measure?

Thanks

2 ACCEPTED SOLUTIONS
Greg_Deckler
Community Champion
Community Champion

You really do not need a measure for this, just create a table visualization and then use the default Max aggregation on your precition column. So ordre and precition in the table visualization. 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

Based on my research, you may create a measure as below.

 

Sum of Max = 
SUMX(
    ADDCOLUMNS(
        SUMMARIZE(
            'Table',
            'Table'[order]
        ),
        "Max",
        CALCULATE(
            MAX('Table'[precition]),
            FILTER(
                ALL('Table'),
                'Table'[order] = EARLIER('Table'[order])
            )
        )
    
    ),
    [Max]
)

 

 

Result:

c1.png

 

You can also create a calculated table as below

NewTable = 
ADDCOLUMNS(
        SUMMARIZE(
            'Table',
            'Table'[order]
        ),
        "Max",
        CALCULATE(
            MAX('Table'[precition]),
            FILTER(
                ALL('Table'),
                'Table'[order] = EARLIER('Table'[order])
            )
        )
    
)

 

Result:

g1.png

 

Best Regards

Allan

 

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
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

Based on my research, you may create a measure as below.

 

Sum of Max = 
SUMX(
    ADDCOLUMNS(
        SUMMARIZE(
            'Table',
            'Table'[order]
        ),
        "Max",
        CALCULATE(
            MAX('Table'[precition]),
            FILTER(
                ALL('Table'),
                'Table'[order] = EARLIER('Table'[order])
            )
        )
    
    ),
    [Max]
)

 

 

Result:

c1.png

 

You can also create a calculated table as below

NewTable = 
ADDCOLUMNS(
        SUMMARIZE(
            'Table',
            'Table'[order]
        ),
        "Max",
        CALCULATE(
            MAX('Table'[precition]),
            FILTER(
                ALL('Table'),
                'Table'[order] = EARLIER('Table'[order])
            )
        )
    
)

 

Result:

g1.png

 

Best Regards

Allan

 

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

Greg_Deckler
Community Champion
Community Champion

You really do not need a measure for this, just create a table visualization and then use the default Max aggregation on your precition column. So ordre and precition in the table visualization. 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
AilleryO
Memorable Member
Memorable Member

Hi @Anonymous ,

 

Just using a measure like :

BiggestPrecition =MAX(Precition)

and then build a table with :

ordre and the BiggestPrecition you just created.

Should give you required results,

 

Let us know and click on Accept as solution if it works.

 

Have a nice day

Anonymous
Not applicable

You are absolutely correct.

I forgot to mention if they want to remove the order from the table and look at week instead. Then I don't want the max of the week but a sum of all the max of each order.

Hope this make sense

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.