Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
So I have multiple years of data, and I cannot seem to get the correct YTD percentage total.
here is my measurement:
YTD Percentage Change =IF(ISFILTERED('Sheet1'[Date and Time]),ERROR("Time intelligence quick measures can only be grouped or filtered by the Power BI-provided date hierarchy or primary date column."),VAR __PREV_YEAR =CALCULATE(COUNTA('Sheet1'[Incident]),DATEADD('Sheet1'[Date and Time].[Date], -1, YEAR))RETURNDIVIDE(COUNTA('Sheet1'[Incident]) - __PREV_YEAR, __PREV_YEAR))
However, When I use my slicer to separate the "incident" value the YTD displays as
2023, 30, -48.61%
2022, 47, 24.14%...
But as you see using a YTD calculator
(30-47) / |47| * 100 = 36.17%
I am also using a filter for dates and manually updating or checking which dates to display.
Solved! Go to Solution.
Hi @GJeanes1 ,
Please try:
YTD Percentage Change =
IF (
ISFILTERED ( 'Sheet1'[Date and Time] ),
ERROR ( "Time intelligence quick measures can only be grouped or filtered by the Power BI-provided date hierarchy or primary date column." ),
VAR __PREV_YEAR =
CALCULATE (
COUNTA ( 'Sheet1'[Incident] ),
DATEADD ( 'Sheet1'[Date and Time].[Date], -1, YEAR )
)
VAR __SELECTED_DATE =
DATESYTD ( MAX ( 'Sheet1'[Date and Time].[Date] ), "Calendar Year" )
RETURN
DIVIDE (
CALCULATE ( COUNTA ( 'Sheet1'[Incident] ), __SELECTED_DATE ) - __PREV_YEAR,
__PREV_YEAR
)
)
Best Regards,
Gao
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
Hi @GJeanes1 ,
Please try:
YTD Percentage Change =
IF (
ISFILTERED ( 'Sheet1'[Date and Time] ),
ERROR ( "Time intelligence quick measures can only be grouped or filtered by the Power BI-provided date hierarchy or primary date column." ),
VAR __PREV_YEAR =
CALCULATE (
COUNTA ( 'Sheet1'[Incident] ),
DATEADD ( 'Sheet1'[Date and Time].[Date], -1, YEAR )
)
VAR __SELECTED_DATE =
DATESYTD ( MAX ( 'Sheet1'[Date and Time].[Date] ), "Calendar Year" )
RETURN
DIVIDE (
CALCULATE ( COUNTA ( 'Sheet1'[Incident] ), __SELECTED_DATE ) - __PREV_YEAR,
__PREV_YEAR
)
)
Best Regards,
Gao
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
@GJeanes1 See if this video helps, it presents a bunch of different options for calculations like this:
User | Count |
---|---|
25 | |
12 | |
8 | |
7 | |
7 |
User | Count |
---|---|
25 | |
12 | |
11 | |
10 | |
6 |