Forum Discussion

PowerBI-Newbie's avatar
6 years ago
Solved

Average YTD Calculation Based on User Selection

Hi, I have the following data:     I am able to filter out by each year and period and the correct YTD figure displays thanks to help from Power BI Superusers:   I now want to change the ...
  • Icey's avatar
    Icey
    6 years ago

    Hi PowerBI-Newbie ,

     

    How about this:

    Average Planned YTD =
    VAR SelectedPeriod =
        SELECTEDVALUE ( 'Table'[Period] )
    VAR MaxPeriod =
        MAX ( 'Table'[Period] )
    RETURN
        IF (
            SelectedPeriod = BLANK (),
            [Planned (YTD)] / MaxPeriod,
            [Planned (YTD)] / SelectedPeriod
        )
    

     

    Best Regards,

    Icey

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.