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
Sac
Helper I
Helper I

How to Calculate sales by month

Id    Sale           Date

1      $5               01/02/2017

2      $6              01/02/2017

3       $13              01/02/2017

4       $32              05/02/2016

5       $23              05/02/2016

 

I want Output like below:

 

Febuary 2017    Febuary 2016

$24                      $55

1 ACCEPTED SOLUTION
BhaveshPatel
Community Champion
Community Champion

Hi Sac,

 

you should Create a MonthYear Column in your table and drag that onto the visaul along with measure to see the correct results.123.png

 

 

Thanks & Regards,
Bhavesh

Love the Self Service BI.
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to give Kudos.

View solution in original post

8 REPLIES 8
vanessafvg
Super User
Super User

@Sac

 

i would start with creating a date table

 

https://www.mattmasson.com/2014/02/creating-a-date-dimension-with-a-power-query-script/

 

then create a relationship between your date and the table date

 

then create  measure call total sales

 

total sales = sum(sale)





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Dear,

 

Thank you for solution but it is not working for me. i already tried this one before. Do you have any other that best fit in power bi ?

@Sac what do you mean by its not working for you? be specific with what the problem is





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




I create date and load my data .then make relationship between it.

Then i write this function:

 

totalsales = SUM(Master[Freight Charge]).

 

Its give me only total cost , not month by month . 

 

BhaveshPatel
Community Champion
Community Champion

Hi Sac,

 

you should Create a MonthYear Column in your table and drag that onto the visaul along with measure to see the correct results.123.png

 

 

Thanks & Regards,
Bhavesh

Love the Self Service BI.
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to give Kudos.

HI Your solution works (apart from "mmmm" which throws error), but the problem of the chronological order in the graph remains. Obviously ordering on the date constructed as you indicate leads to an incongruous result (e.g. 2022-1 / 2022-10 ...). Is there a way to sort chronologically correctly?

example

ordering.jpg

This isn't working for me.  Here's what I get step by step:

 

1- Add month

 

add monthadd month

 

2 - Add november and october from their repsective tables:

 

doesntstack.PNG

 

For some reason every month keeps fanning out to the right rather than just being a row in the same column.  Why does it do this? super annoying...

Thank you. Its work for me

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.