How to do YTD 2022, 2021 in Tabular Editor to use in PowerBI

Rider, Kelli A 0 Reputation points
2023-03-09T22:38:22.9+00:00
I am trying to get this formula to work in Tabular Editor - Calculation Group to use in PowerBI. I don't care if it is a calculation group or Advanced Scripting. Just want to create for the time periods YTD 2023 (that one is easy), YTD 2022, YTD 2021, YTD 2020 and YTD 2019.  So all periods will show 1/1 - 3/4 (or latest date) for each of those 5 years.

This is my PowerBi measure and it works: 

YTD 2022 Margin = calculate(Margin $],Filter(ALL(Dates), Dates[Year] = Max(Dates[Year]) - 1  && Dates 

                                          [MonthSequentialNumber] <= Max(Dates[MonthSequentialNumber]) - 12) )

This is what I have in Tabular Editor and it gives me the WHOLE year for 2022 vs YTD through Feb 2022


calculate(
selectedmeasure (),
filter (ALL(Dates), Dates[Year] = Max(Dates[Year]) - 1  && Dates [MonthSequentialNumber] <= Max(Dates[MonthSequentialNumber]) - 12)
)

I am not proficient in anything Dax, coding and pretty much everything I do I have to watch a video, so HELP please!
Not Monitored
Not Monitored
Tag not monitored by Microsoft.
35,762 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Dave Patrick 426K Reputation points MVP
    2023-03-09T22:49:58.1233333+00:00

    Power Bi is not currently supported here on Q&A. The product group for Power Bi actively monitors questions over at https://community.powerbi.com/

    --please don't forget to upvote and Accept as answer if the reply is helpful--

    0 comments No comments