Forum Discussion
obriaincian
4 years agoResolver I
Power BI - Calculated Column, Error with variables
Can someone please tell me why the second variable is erroring:
var _max = maxx(filter(Table, [Product] =earlier([Product]) && [Date] <earlier([Date)),[Date]) var _exp = maxx(filter(Table, [Product] =earlier([Product]) && [Date] =_max),[Expiry Date])
return
Switch ( true(),
isblank([Expiry Date]) , "No Expiry Date",
[Expiry Date] =_exp , "No Change",
_exp>EOMONTH([Expiry Date],0),"> 1 month change",
_exp<EOMONTH([Expiry Date],0),"< 1 month change"
)
obriaincian , I can see square bracket is missing in earlier of Date:
var _max = maxx(filter(Table, [Product] =earlier([Product]) && [Date] <earlier([Date])),[Date])
4 Replies
- Tahreem24Super User
obriaincian What error are you getting?
- obriaincianResolver I
Tahreem24 , it's saying the syntax for var is incorrect
- Tahreem24Super User
obriaincian Refer my another reply regarding missing square bracket of earlier([Date]) in first var.
- Tahreem24Super User
obriaincian , I can see square bracket is missing in earlier of Date:
var _max = maxx(filter(Table, [Product] =earlier([Product]) && [Date] <earlier([Date])),[Date])