Working with variables
A variable is simply a formula turned into a local object that can be viewed and used from the Available objects pane and treated just as any other object that exists in the report and was retrieved by the query.
Another way to define a variable is that it is a formula that has a name.
During creation, a formula inserts its result into a specific and usually a single column; to build a variable is just like saying that we have created a global formula in the report that can easily be used in every report tab, table, and chart.
There are several advantages to creating a variable compared to a formula:
We can reuse a variable easily without needing to copy and paste or recreate the formula
Variables can be used in filters, ranking, and conditional formatting, while formulas can't
When creating a variable, we can give it a business term rather than dealing with a long and sometimes complex syntax; this option is even more useful when we have a complex calculation that is combined...