Skip to content

Commit

Permalink
chore: Backport #3978 to web (#3979)
Browse files Browse the repository at this point in the history
Co-authored-by: Rich Brown <richb.hanover@gmail.com>
  • Loading branch information
prql-bot and richb-hanover authored Dec 20, 2023
1 parent f394f93 commit b521afd
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ Use a PRQL _alias_ to assign each column a nice name. This becomes its column
heading. The examples above might be:

```prql
select [
select {
Appraisal2020 = (dollars App_Total2020),
`Appraisal 2021` = (dollars App_Total2021),
]
}
```

Note how the second example puts the column heading in backticks to preserve
Expand Down Expand Up @@ -92,13 +92,13 @@ produces.

```prql
# dollars displays a numeric value as dollars with commas
let dollars = d -> s"""printf("$%,d",{d})"""
let dollars = d -> s"""printf('$%,d',{d})"""
# percent_diff computes the amount (percent) the new differs from old
let percent_diff = old new -> 100.0*( new - old ) / old
# format_percent prints a floating point number with "%"
let format_percent = v -> s'printf("%1.1f%", {v})'
let format_percent = v -> s"printf('%1.1f%', {v})"
# Step 1: First calculate important columns
from PropertyData
Expand All @@ -110,15 +110,15 @@ select {
}
# Step 2: Sort the resulting table by pct_change
sort [-pct_change]
sort {-pct_change}
# Step 3: Format the column headings and contents
select [
select {
Map, Lot,
Appraisal2020 = (dollars App_Total2020),
`Appraisal 2021` = (dollars App_Total2021),
`Percent Change` = (format_percent pct_change),
]
}
take 20
```

Expand Down

0 comments on commit b521afd

Please sign in to comment.