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
Irwin
Helper IV
Helper IV

Need help - How to implement YTD in my measurement

Hi Guys,

 

I have the below measurement. So far I have put a filter on it to only use data from "In this year", however I need it to be YTD.

I know there exits a "TOTALYTD". Can this be used somehow in my measurement?

 

Thank you for all help. Much appreciated. 🙂

 

Completion Rate =
VAR OffTime =
Calculate (
Counta ('Performance Management'[CompletionStatus]),
Filter ('Performance Management', 'Performance Management'[CompletionStatus] = "Completed Off Time")
)
VAR OnTime =
CALCULATE(
COUNTA('Performance Management'[CompletionStatus]),
FILTER('Performance Management', 'Performance Management'[CompletionStatus] = "Completed On Time")
)
RETURN
Divide ( OnTime, OnTime + OffTime) + 0
1 ACCEPTED SOLUTION

In such a scenario you will want to add a TODAY() based filter.  You can choose if you want to do this as a calculated column (which would required frequent, ie daily, refreshes of your import mode data source) or a measure if your data source is Direct Query.

View solution in original post

7 REPLIES 7
lbendlin
Super User
Super User

 

Completion Rate =
Var CurrentYear = <calculation for year>
VAR OffTime =
Calculate (
Counta ('Performance Management'[CompletionStatus])
,'Performance Management'[CompletionStatus] = "Completed Off Time"
,'Performance Management'[Year]=CurrentYear
)
VAR OnTime =
CALCULATE(
COUNTA('Performance Management'[CompletionStatus])
,'Performance Management'[CompletionStatus] = "Completed On Time"
,'Performance Management'[Year]=CurrentYear
)
RETURN
Divide ( OnTime, OnTime + OffTime) + 0

 

 

Here would be one option.  

Unfortunately that doesnt work. Syntax error.
If it did work I think this would still be current year? I need YTD 

 

 

Thank you for your response.

Did you adjust the formula according to your column names?

Please explain the difference between"current" and "YtD".

Hi yes of course.
So "Current year" is all performance activities completed in this year. That means that some activities can already be completed for december. We are not in december yet, so I do not want to include these in my calculation.

 

As you probably are very aware PBI has the option to add date filters to the figures (ie. "In this year"). This shows all performance management activites also those completed already but schedueled for december.

 

I want PBI to just do the above measure from 1. of january 2021 till today. 

 

Does that make sense?

In such a scenario you will want to add a TODAY() based filter.  You can choose if you want to do this as a calculated column (which would required frequent, ie daily, refreshes of your import mode data source) or a measure if your data source is Direct Query.

Hi again,
It took me 2 min to create

" Today or Before = IF('Performance Management'[Deadline] <= TODAY(), True, False) " 

Using my original formula and this as a filter with "True" plus my earlier "In this year" filter gives me the result I wanted.

 

Thank you so much. So easy. 🙂

Sounds like this might be the solution. I have refreshes on my dataset twice a day. I will try to read somemore and see if I can come up with a solution. Thank you for your assistance.

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.