Forum Discussion
alihijazi
10 years agoHelper I
parameters
Hello I'm new to powerBI
Is there a way to create a variable or parameter like vMaxYear = year(max(TrxDate)) and then use this parameter or variable in the filter of a calculate Dax expression?
2 Replies
- Eric_ZhangMicrosoft Employee
You could declare a variable as below
LatestYearSumTotal =
VAR MaxYear = YEAR(max(Orders[OrderDate]))
RETURN
CALCULATE(
SUM(Orders[Freight]),FILTER(Orders,YEAR('Orders'[OrderDate])=MaxYear)) - Greg_DecklerCommunity Champion
So the answer is probably yes, but would need more specifics.