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
powerbiexpert22
Impactful Individual
Impactful Individual

max sales for each product and for each month

i want to show maximum sales for each product and for each month in below table. sample pbix is attached. the expected output for product "All - Purpose Bike Stand" should be 318 instead of 159. i tried below but it is not giving correct results 

 

https://drive.google.com/file/d/15fAZVG1YOSgVVn4R6kDZ5J-NEmCFMQMk/view?usp=drive_link

 

 

Highest sales value for any Product =
var last_date=max('Calendar'[Date])
RETURN
CALCULATE(
    MAX(FactInternetSales[SalesAmount]),
    FILTER(ALL('Calendar'[Date]),
    'Calendar'[Date]<=last_date),
     FILTER(ALL(DimProduct[ProductKey]),
    DimProduct[ProductKey]<=MAX(DimProduct[ProductKey])))

 

I want to show in below table

powerbiexpert22_0-1759129429345.png

 

below is the sales distibution for each day in a month:

powerbiexpert22_1-1759130310757.png

 

 

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@powerbiexpert22 , check this, I have forced a day level sum and then max 

Highest sales value for any Product = 
var last_date=max('Calendar'[Date])
RETURN
CALCULATE(
    Maxx(SUMMARIZE(FactInternetSales, 'Calendar'[Year],'Calendar'[MonthNo], 'Calendar'[Date], DimProduct[ProductKey], "_1", CALCULATE(Sum(FactInternetSales[SalesAmount]))), [_1]),
    FILTER(ALL('Calendar'[Date]),
    'Calendar'[Date]<=last_date),
     FILTER(ALL(DimProduct[ProductKey]),
    DimProduct[ProductKey]=MAX(DimProduct[ProductKey])))
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

6 REPLIES 6
v-ssriganesh
Community Support
Community Support

Hello @powerbiexpert22,

We hope you're doing well. Could you please confirm whether your issue has been resolved or if you're still facing challenges? Your update will be valuable to the community and may assist others with similar concerns.

Thank you.

ribisht17
Super User
Super User

hi @powerbiexpert22 

Max Sales per Product per Month =
CALCULATE(
MAXX(
SUMMARIZE(
FactInternetSales,
DimProduct[ProductName],
'Calendar'[Year],
'Calendar'[Month],
"MonthlySales", SUM(FactInternetSales[SalesAmount])
),
[MonthlySales]
)
)

 

Regards,

Ritesh

Community Champion

Please mark the answer if helpful so that it can help others

Dance-Sing with Data -BI & Analytics

Ashish_Mathur
Super User
Super User

Hi,

Write these measures

Sales = SUM(FactInternetSales[SalesAmount])
Max sales = maxx(VALUES('Calendar'[Date]),[Sales])

Hope this helps.

Ashish_Mathur_0-1759633102278.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-ssriganesh
Community Support
Community Support

Hello @powerbiexpert22,

Hope everything’s going great with you. Just checking in has the issue been resolved or are you still running into problems? Sharing an update can really help others facing the same thing.

Thank you.

 

v-ssriganesh
Community Support
Community Support

Hi @powerbiexpert22,

Thank you for posting your query in the Microsoft Fabric Community Forum, and thanks to @amitchandak for sharing valuable insights.

 

Could you please confirm if your query has been resolved by the provided solutions? This would be helpful for other members who may encounter similar issues.

 

Thank you for being part of the Microsoft Fabric Community.

amitchandak
Super User
Super User

@powerbiexpert22 , check this, I have forced a day level sum and then max 

Highest sales value for any Product = 
var last_date=max('Calendar'[Date])
RETURN
CALCULATE(
    Maxx(SUMMARIZE(FactInternetSales, 'Calendar'[Year],'Calendar'[MonthNo], 'Calendar'[Date], DimProduct[ProductKey], "_1", CALCULATE(Sum(FactInternetSales[SalesAmount]))), [_1]),
    FILTER(ALL('Calendar'[Date]),
    'Calendar'[Date]<=last_date),
     FILTER(ALL(DimProduct[ProductKey]),
    DimProduct[ProductKey]=MAX(DimProduct[ProductKey])))
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

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