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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
n5722
Helper I
Helper I

Sum from beginning of quarter to today's date

Hello,

I don't know how to do the following so could someone please give me some advice? I already checked multiple forum posts regarding similar issues but I could not implement it in a way that works.

Screenshot 2021-05-10 at 13.46.10.png

 

In the graph above (which shows the period of Q2) I want to calculate:

- the sum of the dark blue area (named "actual") that should start from the first day of the quarter and end on today's date
and add that to the
- sum of the light blue area (named "forecast") that should start from today's date and end on the last day of the quarter

Both of them are connected to a Date Helper table.

Any advice would be much appreciated!

Thanks!

1 ACCEPTED SOLUTION
Krutigawale33
Responsive Resident
Responsive Resident

Hello @n5722 ,

 

Create below measures,

 

Max Date QTR Start =
DATE ( YEAR(MAX('Date'[Date])), ROUNDUP ( DIVIDE ( MONTH (MAX('Date'[Date])),3 ),0 ) *3 -2, 1)
 
Max Date Qtr End =
EOMONTH ( [Max Date QTR Start],2 )
 
Actual =
CALCULATE(Sum('Table'[Actual]),DATESBETWEEN('Date'[Date],[Max Date QTR Start],TODAY()))
 
Forecast = 
CALCULATE(Sum('Table'[Forcast]),DATESBETWEEN('Date'[Date],TODAY(),[Max Date Qtr End]))

View solution in original post

2 REPLIES 2
Krutigawale33
Responsive Resident
Responsive Resident

Hello @n5722 ,

 

Create below measures,

 

Max Date QTR Start =
DATE ( YEAR(MAX('Date'[Date])), ROUNDUP ( DIVIDE ( MONTH (MAX('Date'[Date])),3 ),0 ) *3 -2, 1)
 
Max Date Qtr End =
EOMONTH ( [Max Date QTR Start],2 )
 
Actual =
CALCULATE(Sum('Table'[Actual]),DATESBETWEEN('Date'[Date],[Max Date QTR Start],TODAY()))
 
Forecast = 
CALCULATE(Sum('Table'[Forcast]),DATESBETWEEN('Date'[Date],TODAY(),[Max Date Qtr End]))

Works like a charm! Thank you so much!

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.