Forum Discussion

obriaincian's avatar
obriaincian
Resolver I
4 years ago
Solved

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