Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
Please give an example for only(expression ). I did not understand. Thanks in advance.
Hopefully this will give some clarity.
Script:
Table:
LOAD * Inline [
Dim1, Dim2, Value
A, India, 10
A, India, 20
B, USA, 30
];
When I create a text box with the expression =Only(Dim2) with no selection, I will see '-' because Dim2 has two values (India and USA).
But when I select one of them, I will see that name in there. For example when I select India I will see India in the text box object
So, basically when there is only one available value to display, you can use Only() function. Alternatively you can get the same result by just Putting Dim2. But the benefit of using Only() function is that you can use Set analysis with the Only() function.
HTH
Best,
Sunny
Hie..
If expression over a number of records, as defined by a group by clause, contains only one numeric value, that value is returned. Else, NULL is returned.
Example 1:
Load Month, only(Price) as OnlyPriceSoldFor from abc.csv group by Month;
Example 2
=wildmatch(capitalize(only({1}Month)),'APR','MAY','JUN','JUL','AUG','SEP','OCT','NOV','DEC','JAN','FEB','MAR')
Hope this will helps you to understand only Function
Regards,
Mohammad
Hopefully this will give some clarity.
Script:
Table:
LOAD * Inline [
Dim1, Dim2, Value
A, India, 10
A, India, 20
B, USA, 30
];
When I create a text box with the expression =Only(Dim2) with no selection, I will see '-' because Dim2 has two values (India and USA).
But when I select one of them, I will see that name in there. For example when I select India I will see India in the text box object
So, basically when there is only one available value to display, you can use Only() function. Alternatively you can get the same result by just Putting Dim2. But the benefit of using Only() function is that you can use Set analysis with the Only() function.
HTH
Best,
Sunny
I did not understand Example 2.
Please apply to second tab of attached application. Thank you.
If ur charts month(Dimension) is not in sort form at that time we will use this expression....
Can you please provide an example for set analysis case?
I think, whenever we get a scenario where we cannot use any aggregate function like sum, count whereas we need to use set analysis... in that case we can use only... am i right?
Hi,
When there is one to one relation ship, we can use only function.
In simple word,
Table:
LOAD * Inline [
Dim1, Dim2, Value
A, India, 10
B, USA, 30
];
If we use Dim1 in textbox without any selection , it display null value for both
=Only(Dim1) or Dim1
If We select any value in Dim1, it display the Value in textbox.
If we need to use "Set Analysis", in that case we can use Only() function.
Only({<Dim2 = {'India'}>}Dim1) display A.
Here have a look at the this example:
Now you will see that even without making any selection, I am able to see a result. The reason is that within Dim1 = 'A' there is only one value available for Dim2 (India).
HTH
Best,
Sunny
Thank you All.