I have five columns in my dataset: Location, Vendor, Week, Number, Value. I’m trying to return the previous value for the Value field, sorted by week + number (both DESC), and partitioned by location + vendor.
My first thought was to use the Lag function and just grab the previous row, but when I try to create this field in the dataset, I just get “Unavailable” for the whole column. If I try to strip out the complexity and just grab the previous Value, with no sort or partition, I get a syntax error.
Does anyone have any advice on how to get this function set up properly? Thanks!
I read your first post again. You are building the formula in your dataset: “to create this field in the dataset”
The lag function is a table calculation, please try to create that field in an analysis. Before you add your formula to the analysis, add the fields to your visual and the the calculated field.
Best regards,
Nico
Did my suggestion help you in resolving your query? If yes, would request you to mark the post as “Solution”. This will help the community to find guidance and answers to similar question. Thank you!
Following up here as it’s been awhile since we last heard from you on this thread; did you have any additional questions regarding your initial post or were you able to find a work around?
If we do not hear back within the next 3 business days, I’ll close out this topic.
Since we have not heard back, I’ll go ahead and close out this topic. However, if you have any additional questions, feel free to create a new post in the community.