Forum Discussion

mikebi's avatar
mikebi
Helper III
2 years ago
Solved

YTD Calculation

Hello,

 

Are these two measures the same and equivalent?  Is there a reason to use one over the other?  I think when I first started learning DAX I would write out my measures as in the Calc Measure but now there are functions that can be used.

 

Thank You,

 

Michael

 

YTD Revenue =
CALCULATE(
[Total Revenue],
DATESYTD(
'Calendar Lookup'[Date]
)
)

 

YTD Revenue Calc =
Var _Year = SelectedValue('Calendar Lookup'[Year])
Var _Month = SelectedValue('Calendar Lookup'[Month])

Var _Amount = Calculate([Total Revenue],Filter(All('Calendar Lookup'),'Calendar Lookup'[Year]=_Year && 'Calendar Lookup'[Month]<=_Month))

Return _Amount

 

 

 

2 Replies

    • mikebi's avatar
      mikebi
      Helper III

      Hello, 

      I assume the purpose of the Union is to generate random data?

      I like the solution.

       

      Michael