Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

YTD calculations without date table

Hi 

 

I don't have date column in my data set but i have period(month) like 1,2,3...12. how can i do YTD calculations without having dates. 

I want to create a graph visual of YTD by sales organisation. 

 

Thanks,

Paruchuri

  • YTD is all months until the one selected, so something like this would work:

    Measure YTD =
    VAR SelectedMonth =
        MAX ( Table[Period] )
    RETURN
        CALCULATE (
            [Measure],
            FILTER ( ALL ( Table[Period] ), Table[Period] <= SelectedMonth )
        )

3 Replies

  • Stachu's avatar
    Stachu
    Icon for Community Champion rankCommunity Champion

    YTD is all months until the one selected, so something like this would work:

    Measure YTD =
    VAR SelectedMonth =
        MAX ( Table[Period] )
    RETURN
        CALCULATE (
            [Measure],
            FILTER ( ALL ( Table[Period] ), Table[Period] <= SelectedMonth )
        )
    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Stachu,

       

      Thanks for your reply. In calculate function you have used [Measure]. What it is refering to?

      • Stachu's avatar
        Stachu
        Icon for Community Champion rankCommunity Champion

        you should replace it with whatever measure you want to calculate, e.g. 

        SUM(Table[Column])