Manage Data Models in Look Challenge Lab

I am working through the Looker courses on the Google Skills Boost site and the Challenge Lab for the Manage Data Models quest has me stuck. The first part asks you to create a dimension and a measure for profit and total profit. I was able to get the total profit done correctly but it will not validate my answer for profit. Here is what I had for profit. 

dimension: profit {
    label: "Profit"
    description: "Calculates the profit for the items by subtracting cost from retail price."
    type: number
    sql: ${sale_price}-${TABLE}.cost};;
    value_format_name: usd

}

Am I getting the formula wrong? The code validates as accurate.

1 4 383
4 REPLIES 4

I am facing the same issue and couldn’t get past it. Also searched for any solutions online but couldn’t get any.

Hiya!

I do not know the particular task, but some guesses here.

First, this line seems like it has extra bracket at the end:  

  sql: ${sale_price}-${TABLE}.cost};;

We can reference fields as ${cost} or ${TABLE}.cost

And second  - there is an example for profit in the docs and it uses other fields, so maybe…. https://docs.looker.com/reference/field-reference/dimension-type-reference#number

Manage data models in Looker Challenge lab has technical issues for sure. The first task doesn't get through.

I have no special knowledge here, but try

sql: ${sale_price}-${cost};;

If the table column for cost ever changes names, you should only have to change it in one location. Every time you use a ${TABLE}.column expression an additional time, you are increasing the number of places a change in the table needs to be updated. If the underlying table has a column that is used in an expression for another dimension or measure, but is not displayed to the user in its base form, create a hidden dimension or measure for it.

Top Labels in this Space
Top Solution Authors