Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I need to create a calculated measure with several conditions. Theoretically need to implement as an expression:
if (condition) then
else if (condition) then
else
I could only implement the If and Else.
The nested if isn't working?
If(Condition1Met, Something1,
If(Condition2Met, Something2,
If(Condition3Met, Something3.....
Give us more details.
As Sunny said use Nested Ifs.
For example:
LOAD *,
if(value < 2, 'Number is less than 2',
If(value <= 3, 'Number is less or equal to 3', 'Number is more than 3')) as Result
INLINE [
value
1
2
3
4
];
The outcome would be this:
Practically you can you as many nested ifs as you wish. But according to the situation you can apply other methods to reach the result.
but I needed to do the calculation of expressions because they need to calculate only a few lines of the PivotTable.
I can use within expressions? And how I use Else?
If statement can be used in the script and in the expression. In both cases the logic is the same.
If works like following:
IF(logical condition, if logical condition is TRUE then do something, if logical condition is FALSE then do something)
Please test and create few examples yourself and you could easily handle the issue. Or just attach the sample qvw file.
I think if you can provide a sample with your expected output, we might be able to offer you better help rather than some guesswork
Because the goal is a few lines is the sum of a few lines below as in the image:
Hi Thiago,
Have you ever been able to get the answer for your question?
LD