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
Andrrrejka
Regular Visitor

Return quantity of Item ID for Max Month

Hi All.

 

I am looking the way to write DAX neasure to return the quantity of the "Item ID" for the Month with Max quantity. Simplified version of the table is as below. Real table has data with over million lines for 18 months and about 4000 differnt "Item IDs"

Andrrrejka_0-1657014482103.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Andrrrejka ,

 

You can follow the below steps:

1.Create a new table by click “New table” under “Modeling” , then create a measure:

vbinbinyumsft_0-1657531908377.png

 

Table 2 =
SUMMARIZE ( 'Table', 'Table'[Item ID], "MaxQuantity", MAX ( 'Table'[total] ) )

 

 

vbinbinyumsft_1-1657531970643.png

 



2.In report page, add a table visual, then add the data fields, you can get below visualization

 

vbinbinyumsft_2-1657532003072.png

Best regards,
Community Support Team_ Binbin Yu
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

5 REPLIES 5
Anonymous
Not applicable

Hi @Andrrrejka ,

 

According to your description, I made the following attempts

1. create a new column named " Month" in the table

Month =
MONTH ( Sheet1[Date] )

 

vbinbinyumsft_1-1657272231265.png

 


2. Group tables by "Item ID", then in each group, group tables by month and create a new column to sum the "Quantity"

Table =
SUMMARIZE (
    'Sheet1',
    Sheet1[Month],
    Sheet1[Item ID],
    "total", SUM ( 'Sheet1'[Quantity] )
)

vbinbinyumsft_0-1657272203232.png

 

But unfortunately, I don't understand what you mean by this sentence ("Max Month = return value from Table of sum( Quantity) for the month with Max sum(Quantity) for each individual "Item ID" "). Could you explain it further ?

 

If I misunderstand something above, please feel free to let me know.

 


Best regards,
Community Support Team_ Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello, 

I have a separate table for Dates which is fine. 

Based on your calculation I need to create a measure to add it to another measure which would return value with quantity for a Max month. 

E.g. from  this table:

Andrrrejka_0-1657524440010.png

for Item ID 1 it it should return value of 13 and for Item ID 2 - 26 which are Max Values for the month.

 

Anonymous
Not applicable

Hi @Andrrrejka ,

 

You can follow the below steps:

1.Create a new table by click “New table” under “Modeling” , then create a measure:

vbinbinyumsft_0-1657531908377.png

 

Table 2 =
SUMMARIZE ( 'Table', 'Table'[Item ID], "MaxQuantity", MAX ( 'Table'[total] ) )

 

 

vbinbinyumsft_1-1657531970643.png

 



2.In report page, add a table visual, then add the data fields, you can get below visualization

 

vbinbinyumsft_2-1657532003072.png

Best regards,
Community Support Team_ Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Andrrrejka ,The information you have provided is not making the problem clear to me. Can you please explain with an example.

Appreciate your Kudos.

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

Ok, 

I have Data table:

Andrrrejka_0-1657018101303.png

Starting from 01/01/2021 until now.

Each line in Data Table represents a line from invoice where "Item ID" is a product invoiced. Thus, it could be several lines with same "Item ID" per month.

I would like to write the measure to return value for the month with max quantity sold for each "Item ID"

 

Max Month = return value from Table of sum( Quantity) for the month with Max sum(Quantity) for each individual "Item ID"

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.