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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
joshua1990
Post Prodigy
Post Prodigy

Simplify and Optimize YTD Measure

Hello everyone!

We are working with a fiscal calendar in our reports.

That means that I can't use some of these awesome time intelligence functions since our fiscal months have specific start/ end dates.

Due to this "challenge", I use this approach to get the YTD Ration between sales and budget.

Ratio = 
DIVIDE (
    CALCULATE (
        [Sales],
        FILTER (
            ALL ( 'Calendar' ),
            'Calendar'[Fiscal Year]
                = MAX ( 'Calendar'[Year] )
                && 'Calendar'[Date]
                    <= MAX ( 'Calendar'[Date] )
        )
    ),
    CALCULATE (
        [Budget],
        FILTER (
            ALL ( 'Calendar' ),
            'Calendar'[Fiscal Year]
                = MAX ( 'Calendar'[Year] )
                && 'Calendar'[Date]
                    <= MAX ( 'Calendar'[Date] )
        )
    )
)

 

Do you think there is a much more efficient and elegant approach to get this ratio?

Is it useful to you some variables instead of the whole function?

Unfortunately, I get also values for the whole year (future).

How can I limit this measure just until today?

 

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

@joshua1990 - Would need sample data as text and expected output to be more specific. However, you could maybe limit where you return a value using something like this:

Ratio = 
VAR __Calc =
DIVIDE (
    CALCULATE (
        [Sales],
        FILTER (
            ALL ( 'Calendar' ),
            'Calendar'[Fiscal Year]
                = MAX ( 'Calendar'[Year] )
                && 'Calendar'[Date]
                    <= MAX ( 'Calendar'[Date] )
        )
    ),
    CALCULATE (
        [Budget],
        FILTER (
            ALL ( 'Calendar' ),
            'Calendar'[Fiscal Year]
                = MAX ( 'Calendar'[Year] )
                && 'Calendar'[Date]
                    <= MAX ( 'Calendar'[Date] )
        )
    )
)
RETURN
  IF(MAX('Calendar'[Date])>TODAY(),BLANK(),__Calc)

You may find this helpful - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000

Also, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

thanks, @Greg_Deckler : You approach works almost perfectly!

Somehow I need to limit the IF(MAX ... to the current week.

With your approach, the yearly average runs just until the last week.

I need to run the yearly average until this week. But how?

Something like IF ( MAX ( Fiscal Week) > current Week, Blank(), _Calc

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.