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
Peavey
Helper III
Helper III

Aggregate monthly data from daily results

Hi,

 

How can I get this result from daily targets and actuals into an aggregated result to show this graph? 

Tips appreciated 🙂

 

Peavey_0-1730818011314.png

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @Peavey 

Thanks for the reply form Sahir_Maharaj and DataNinja777. You can try their method, or try the following dax.

Target ACC = 
VAR _CurrentDate = MAX('Table'[Date]) 
VAR _StartOfMonth = EOMONTH(_CurrentDate, -1) + 1  
RETURN
CALCULATE(
    SUM('Table'[Target]),
    DATESBETWEEN('Table'[Date], _StartOfMonth, _CurrentDate)
)

Actual ACC = 
VAR _CurrentDate = MAX('Table'[Date]) 
VAR _StartOfMonth = EOMONTH(_CurrentDate, -1) + 1  
RETURN
CALCULATE(
    SUM('Table'[Actual]),
    DATESBETWEEN('Table'[Date], _StartOfMonth, _CurrentDate)
)

vyaningymsft_0-1730861800659.png

 

Best Regards,
Yang

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know.
Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi, @Peavey 

Thanks for the reply form Sahir_Maharaj and DataNinja777. You can try their method, or try the following dax.

Target ACC = 
VAR _CurrentDate = MAX('Table'[Date]) 
VAR _StartOfMonth = EOMONTH(_CurrentDate, -1) + 1  
RETURN
CALCULATE(
    SUM('Table'[Target]),
    DATESBETWEEN('Table'[Date], _StartOfMonth, _CurrentDate)
)

Actual ACC = 
VAR _CurrentDate = MAX('Table'[Date]) 
VAR _StartOfMonth = EOMONTH(_CurrentDate, -1) + 1  
RETURN
CALCULATE(
    SUM('Table'[Actual]),
    DATESBETWEEN('Table'[Date], _StartOfMonth, _CurrentDate)
)

vyaningymsft_0-1730861800659.png

 

Best Regards,
Yang

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know.
Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

@Anonymous  could this also be used to do the same graph from Monday 07:00 to next Monday 07:00? 

Thanks to all yes! @Sahir_Maharaj  & @DataNinja777 

The solution @Anonymous  had fit my model the best and it worked perfectly! Many thanks 🙂

Sahir_Maharaj
Super User
Super User

Hello @Peavey,

 

I would recommended to use a Date table.

DateTable = 
ADDCOLUMNS(
    CALENDAR(MIN('DailyData'[Date]), MAX('DailyData'[Date])),
    "Year", YEAR([Date]),
    "Month", MONTH([Date]),
    "MonthName", FORMAT([Date], "MMMM"),
    "YearMonth", FORMAT([Date], "YYYYMM")
)

Then, create DAX measures to aggregate the daily targets and actuals

MonthlyTarget = 
CALCULATE(
    SUM('DailyData'[Target]),
    ALLEXCEPT('DateTable', 'DateTable'[Year], 'DateTable'[Month])
)
MonthlyActuals = 
CALCULATE(
    SUM('DailyData'[Actual]),
    ALLEXCEPT('DateTable', 'DateTable'[Year], 'DateTable'[Month])
)

Hope this helps.


Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ About: https://sahirmaharaj.com/about.html
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning
DataNinja777
Super User
Super User

Hi @Peavey ,

 

To create a Month-to-Date (MTD) measure, first ensure you have a calendar table with a continuous date range. Then, you can use the TOTALMTD DAX function to calculate the MTD values for actual and target metrics.

Here’s how you might write the measures:

Actual MTD = 
CALCULATE(
    SUM(FactTable[ActualValue]),
    DATESMTD('Calendar'[Date])
)
Target MTD = 
CALCULATE(
    SUM(FactTable[TargetValue]),
    DATESMTD('Calendar'[Date])
)

These measures will calculate the cumulative sum of actual and target values from the beginning of the month up to the current date in the selected month, as defined by your calendar table. Be sure your calendar table is correctly related to the fact table(s) by date.

 

Best regards,

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.