Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
Hi every one, i would like to know if it is possible to simplify my code.
The time spent is way too long and i don't know any alternative to do the same thing but way faster with less if statments.
My code :
Solved! Go to Solution.
There are a few things you can do to clean up the code which will make it easier to read and maintain and also improved performance.
Instead of using FIRSTDATE use MIN. FIRSTDATE returns a table, MIN returns a scalar value and you are using it as a scalar value.
Retrieve all the min dates only once and store them in variables. Currently you have to calculate each minimum date twice, which will impact on performance.
Rather than using the nested IF statements, which are impossible to read, use the pattern
SWITCH( TRUE(),
Condition 1, Result 1,
Condition 2, Result 2,
Default result
)
You could also store the result of the [Email confirmes] measure in a variable, as you are using that twice as well.
There are a few things you can do to clean up the code which will make it easier to read and maintain and also improved performance.
Instead of using FIRSTDATE use MIN. FIRSTDATE returns a table, MIN returns a scalar value and you are using it as a scalar value.
Retrieve all the min dates only once and store them in variables. Currently you have to calculate each minimum date twice, which will impact on performance.
Rather than using the nested IF statements, which are impossible to read, use the pattern
SWITCH( TRUE(),
Condition 1, Result 1,
Condition 2, Result 2,
Default result
)
You could also store the result of the [Email confirmes] measure in a variable, as you are using that twice as well.
User | Count |
---|---|
12 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
24 | |
19 | |
14 | |
10 | |
7 |