Forum Discussion
Cumulative Hrs without Date
Hi and Good day,
The data is auto generated by the system everyday in csv file. The yesterday data will override by today data and new Jobcard will add to Jobcard column. I want to monitor the total cummulative earned hours from today to Dec 31, 2023 to compare on my yearly target, and Start again from Jan 1, 2024 to Dec 31, 2024 for the 2024 yearly target. data as below.
Hope anyone can help on this.
Thank you
2 Replies
- AnalyticPulse
Solution Sage
it's bit tricky to calculate without a file but see if this helps you:
To calculate the cumulative earned hours from today to Dec 31, 2023, and then reset the accumulation from Jan 1, 2024, you can use DAX (Data Analysis Expressions) in Power BI or Excel, assuming your data is loaded into a table. Here's a sample DAX formula for this scenario:
CumulativeEarnedHours =
CALCULATE(
SUM('YourTableName'[EarnedHours]),
FILTER(
ALL('YourTableName'),
'YourTableName'[Date] <= TODAY() && 'YourTableName'[Date] <= DATE(2023, 12, 31)
)
)Replace 'YourTableName' with the actual name of your table, and 'EarnedHours' with the actual column name where the earned hours are stored, and 'Date' with the actual column name where the date is stored.
This formula uses the CALCULATE function to aggregate the sum of earned hours based on the conditions provided in the FILTER function. It considers rows where the date is on or before today's date and on or before December 31, 2023.
If you want to reset the cumulative earned hours for each new year, you can modify the formula like this:
CumulativeEarnedHours =
CALCULATE(
SUM('YourTableName'[EarnedHours]),
FILTER(
ALL('YourTableName'),
'YourTableName'[Date] <= TODAY() && 'YourTableName'[Date] <= DATE(2023, 12, 31)
),
VALUES('YourTableName'[YearColumn]) = YEAR(TODAY())
)Replace 'YearColumn' with the actual name of the column that contains the year information. This modification ensures that the cumulative earned hours are reset at the beginning of each new year.
let me know if this works.
If this helped, Subscribe AnalyticPulse on YouTube for future updates:
https://www.youtube.com/@AnalyticPulse
https://instagram.com/analytic_pulse
https://analyticpulse.blogspot.com/subscribe to Youtube channel For fun facts:
https://www.youtube.com/@CogniJourney - AllanBerces
Post Prodigy
Hi AnalyticPulse,
Thank you for the reply
My concern also i dont have date on my data.
Thank you