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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.