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
Anonymous
Not applicable

Total Sales for partial year

Hi,

I have a measure "TotalSalesYTD"

TotalSalesYTD = CALCULATE (
Sum(Order[Sales]),
FILTER (
ALL ( 'Calendar' ),
'Calendar'[Year] = MAX ( 'Calendar'[Year] )
&& 'Calendar'[Month] = MAX ( 'Calendar'[Month] )))

This is giving the results I wanted for any selected year except for current year 

Obviously, for current year I have the data only till this month

How can I tweak this meausre to also display results for Current year upto current month

 

Note: My data is a monthly snapshot data 

          I have only one filter "Year" 

 

Here's the sample data:

Screen Shot 2020-08-10 at 4.51.25 PM.pngScreen Shot 2020-08-10 at 4.54.36 PM.png

Even though I have year 2020 data till today, the measure is not able to display it

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi,

Thanks you all for your  prompt responces

 

I was able to achieve this by using the below DAX

 

TotalSalesIncludingPartialYear=
Var MaxMonth = MONTH(LASTDATE(Orders[OrderDate]))
RETURN
CALCULATE([TotalSales], 'Calendar'[Month]=MaxMonth)

 

Thank you all

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi,

Thanks you all for your  prompt responces

 

I was able to achieve this by using the below DAX

 

TotalSalesIncludingPartialYear=
Var MaxMonth = MONTH(LASTDATE(Orders[OrderDate]))
RETURN
CALCULATE([TotalSales], 'Calendar'[Month]=MaxMonth)

 

Thank you all

v-eqin-msft
Community Support
Community Support

Hi @Anonymous ,
According to my understanding, you want to calculate the sum of sales ahead of current year date, right?

Here is my data sample, then use the following formula:

8.11.1.PNG

 

Filtered table =
FILTER ( 'Order', 'Order'[Date] < NOW () )
Order year =
YEAR ( 'Filtered table'[Date] )
TotalPerYear =
CALCULATE (
    SUM ( 'Filtered table'[Sales] ),
    ALLEXCEPT ( 'Filtered table', 'Filtered table'[Order year] )
)

 

My visualizations look like this:

8.11.2.PNG
Is the result what you want? If not, please upload some data samples and expected output.
Please do mask sensitive data before uploading.

 

Best Regards,
Eyelyn Qin

Ashish_Mathur
Super User
Super User

Hi,

Just use this measure

=Sum(Order[Sales])


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

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.