Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
I want to use dynamically chosen Month # and Day # from a Fact table (or from the Date dimension table) for the YTD year-over-year comparison. For example, if the chosen date value is 2019-11-05 (or the chosen Month # = 11 and Day # = 5), I want to do the comparison like:
How should I do? Use Slicer for the selection? DATESYTD()? TotalYTD()?
@Anonymous ,
Generally, you may create a measure using dax like pattern below:
Result =
VAR Current_Year =
YEAR ( Table[Date] )
RETURN
CALCULATE (
SUM ( Table[Value] ),
FILTER (
ALLEXCEPT ( Table, Table[Date].[Year] ),
Table[Date]
<= DATE ( Current_Year, SELECTEDVALUE ( Date[Month] ), SELECTEDVALUE ( Date[Day] ) )
)
)
Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If you have them choose a date in the slicer, you can use DAY to get the day and MONTH to get the month. Not sure I understand your question.
User | Count |
---|---|
84 | |
77 | |
76 | |
43 | |
36 |
User | Count |
---|---|
109 | |
56 | |
52 | |
45 | |
43 |