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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
PBI_SUPERUSER
Frequent Visitor

Highest ever Sales in Last 5 Years

I am new to power BI and sturggling with a simple problem which I couldn't get the required result.

 

I have a table with Daily Sales values with several other columns indicating product name,transactionId,customer etc.Using this I have created a matrix with last 5  years sales.I need to have a another column in my matrix with higest sales value in last 5 years.I have used below Dax to get the result but it returns the Last year sales amount not the maximum sales amount.Appreciate if anyone can help me on this.

 

Highest Ever Sales in Last 5 Years =
Var _matrix=SUMMARIZE(sales,calender[FN_YEAR],"Full Year Sales",sum(sales[QUANTITY]))
Var _max=MAXX(_matrix,[Full Year Sales])
return _max
1 ACCEPTED SOLUTION

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1712027957150.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

10 REPLIES 10
Ashish_Mathur
Super User
Super User

Hi,

Share data in a format that can be pasted in an MS Excel file.  Show the expected result very clearly.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi,

Required Out put is as below;

 

PBI_SUPERUSER_1-1711959766874.png

 

 

  1. Sample data set is given below
Date Qunatity CustomerProductCounrtyFinancial Year
01/01/2011                                  19A1B1ABCFY10-11
03/01/2011                                  17A2B2ABCFY10-11
03/01/2012                                    4A3B3ABCFY11-12
03/01/2012                            7,600A4B4ABCFY11-12
03/01/2012                                  51A5B5DEFFY11-12
03/01/2011                                  42A6B6ABCFY10-11
03/01/2011                                  72A7B7ABCFY10-11
01/01/2014                                  15A1B1ABCFY13-14
01/01/2014                                  18A2B2ABCFY13-14
01/01/2014                                  20A3B3ABCFY13-14
01/01/2014                               144A4B4ABCFY13-14
01/01/2014                                  30A5B5DEFFY13-14
01/01/2014                               189A6B6ABCFY13-14
01/01/2014                               104A7B7ABCFY13-14
01/01/2015                                  11A1B1ABCFY14-15
01/01/2015                               194A2B2ABCFY14-15
01/01/2015                               114A3B3ABCFY14-15
01/01/2015                                  99A4B4ABCFY14-15
02/01/2015                                  23A5B5DEFFY14-15
02/01/2015                                  47A6B6ABCFY14-15
02/01/2015                                  23A7B7ABCFY14-15
01/01/2013                                  22A7B7ABCFY12-13
01/01/2013                               102A1B1ABCFY12-13
01/01/2013                                  82A2B2ABCFY12-13
01/01/2013                                  10A3B3ABCFY12-13
02/01/2013                                  35A4B4ABCFY12-13
02/01/2013                                  30A5B5DEFFY12-13
02/01/2013                                  18A6B6ABCFY12-13

Thanks in advance!

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1712027957150.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thank you very much for the support.This is what I wanted.

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Does the Fy run from April - March?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Yes.Financial Year runs from Apr-Mar

v-huijiey-msft
Community Support
Community Support

Hi @PBI_SUPERUSER ,

 

Thanks for the reply from @AnalyticPulse , please allow me to provide another insight:

 

Please try:

Highest Ever Sales in Last 5 Years = 
CALCULATE(
MAX(sales[sales]), 
FILTER(
ALL(calender[FN_YEAR]), 
calender[FN_YEAR] > YEAR(TODAY()) - 5
)
)

 

Replace sales[sales]) with your own field.

 

This measure shows the columns with the highest sales in the last 5 years.

 

The page visualization is as follows:

vhuijieymsft_0-1711940575995.png

 

The pbix file is attached.

 

If you have any other questions please feel free to contact me.

 

I would be grateful if you could provide me with sample data for testing, please remove any sensitive data in advance.

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

Thanks for your time to provide me an answer.But my expected solution is different.Out of  last 5 years total sales values ,I need the value of higest value.

AnalyticPulse
Impactful Individual
Impactful Individual

you can use beow dax and let me know if that works:
Highest Ever Sales in Last 5 Years =
VAR MaxSales = CALCULATE( MAX( Sales[SalesAmount] ), LASTNONBLANK( Dates[Year], [Total Sales] ) )
RETURN
MaxSales

if this resolved your issue mark this reply as an aswer.

 

here are some blogs that can help you understand basic dax functions;
summarize and summarize column in powerbi

mastering-time-intelligence-with-power bi 
complex-real-life-dax-examples 

If this helped, Follow this blog for more insightful information about data analytics
https://analyticpulse.blogspot.com/

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.