Camilo Sampedro
Camilo Sampedro

Reputation: 1436

Is it possible to have a constant value in a calculated field in QuickSight?

In QuickSight, when you want to define a constant value to reuse it in visualizations later, you can try to set it as:

But right now it doesn't allow you to put just a number in the formula.

Is there any way to do achieve having just a number in the formula of a calculated field?

The reason we need it is just to have a number that doesn't depend on any data, just manually defined by us.

Upvotes: 0

Views: 5337

Answers (3)

sophie03120203 xu
sophie03120203 xu

Reputation: 1

I have tried something like this: distinct_countIf({dimension},{dimension}='xxx')* +distinct_countIf({dimension},{dimension}='xxx')*

just makes the discount_countif meet the requirement, so it will return to 1. And use 1* the number you want to hardcode. If the requirement does not meet, it will return 0 so it won't add up the number

Upvotes: 0

mjgpy3
mjgpy3

Reputation: 8937

Interesting, QuickSight lets me insert a number into a calculated field, just fine.

Insert number in calc working

Since that isn't working for you, I'd recommend using a parameter with a default value. For example,

Parameter

Parameters essentially has the same "rights" as a calculated field (it can be used in visuals, other calculated fields, etc...). It can also be passed via query parameters which may or may not be a feature that you'd find useful.

Another cool benefit of using parameters is that, if you're embedding QuickSight, you could retrieve this value dynamically and pass it to the dashboard. Then if you wanted to, say, generalize your for different yearly goals, the goal could be passed and dynamic (rather than hard-coded in a calculated field).

Upvotes: 3

Camilo Sampedro
Camilo Sampedro

Reputation: 1436

We could achieve it with a trick, just apply some function that returns a number to one of your columns, and make it 0, then add your constant number:

  • Calculated field: goalFor2020
  • Formula: count(email) * 0 + 20000

It does the trick, but there might be a better way to do it.

Upvotes: 2

Related Questions