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
erhan_79
Post Prodigy
Post Prodigy

Sum Measure

Hi there ;

 

İ need your quick and small help 🙂

 

i have a table as below , i  need to calculate sum of  quantites based on current month for date column

 

as you see  current month October , and i want to create a measure which gives total quantity 180 pcs 

 

 

Capture.JPG

 

1 ACCEPTED SOLUTION
PaulDBrown
Community Champion
Community Champion

@erhan_79 

Best practices encourage the use of a Date table with continuous dates covering the range of dates in the model as a dimension table. If you create a Date Table, you can use:

Current month =CALCULATE(SUM(table[Qty], FILTER( Date Table, MONTH(Date Table[Date]) = MONTH(TODAY()))

 

without a date table, you can use:

 

Current month =CALCULATE(SUM(table[Qty], FILTER(  Table, MONTH(Table[Date]) = MONTH(TODAY()))

 

beware that both these measures filter for the current month number, so disregard the year. 
If you need to make it the current month for this year, use:

 

Current month =CALCULATE(SUM(table[Qty], FILTER( Date Table, MONTH(Date Table[Date]) = MONTH(TODAY())

&& YEAR(Date Table[Date]) = YEAR(TODAY()))





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

2 REPLIES 2
PaulDBrown
Community Champion
Community Champion

@erhan_79 

Best practices encourage the use of a Date table with continuous dates covering the range of dates in the model as a dimension table. If you create a Date Table, you can use:

Current month =CALCULATE(SUM(table[Qty], FILTER( Date Table, MONTH(Date Table[Date]) = MONTH(TODAY()))

 

without a date table, you can use:

 

Current month =CALCULATE(SUM(table[Qty], FILTER(  Table, MONTH(Table[Date]) = MONTH(TODAY()))

 

beware that both these measures filter for the current month number, so disregard the year. 
If you need to make it the current month for this year, use:

 

Current month =CALCULATE(SUM(table[Qty], FILTER( Date Table, MONTH(Date Table[Date]) = MONTH(TODAY())

&& YEAR(Date Table[Date]) = YEAR(TODAY()))





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Sumanth_23
Memorable Member
Memorable Member

hi @erhan_79 - You can follow the below steps to derive this: 

#1 Create a calculated column for Month

Order_Month = Month ( Date ) 

#2 Create a measure for total quantity

Tot_Qty = Sum ( Qty )

 

Now if you pull the measure into a table visual and use the Order_Month value as a column then you should see the total quantity by month

 

Please mark the above comment as a solution to help others find it more quickly. Also please provide a 👍 if my comment helped with solving your issue. Thanks!

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!

Proud to be a Super User!



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.