Hi, I am looking to find out how I can display a value in a Label within a measure Measure based on a selection from a SimpleFieldSelect Extension.
I currently have the following 4 options on my page:
A | B | C | D
at present I have the following as part of my label:
=FieldValue('product_name', '1')
which I know will always show the first value no matter what I select. What I would like to do is to make this label dynamic so that this displays a single value of whatever is selected i.e. A, B, C or D and if more than 1 value is selected than I would like this value to change to ALL.
I am not sure if this is possible to do within the label field or whether I need to create a variable and then call it, but would love some advice as to what the best practice is to achieve this.
If(getSelectedCount(product_name)=1, product_name, 'ALL')
If(getSelectedCount(product_name)=1, product_name, 'ALL')
Brilliant, thank you so much, that worked!
Hello @tresesco .
What would this command turn into if we want to show 2 selected values?
For example I've put a filter pane for Year select in the dashboard and a KPI showing Values based on the Years selected. With the command given above, if I select 2023, the label shows "2023". But if I select 2022 and 2023 in the filter pane, I would like to see "2022-2023" in the label section. Is this possible with a nested "if" in the given command?
I've tried this :
If(getSelectedCount([Έτος])=1,'Stock Value '& Έτος,
If(getSelectedCount([Έτος])=2,'Stock Value '& Έτος,
'ALL'))
but it's obviously wrong.
Thank you in advance.
Finally, I found something that seems to work :
=If(getSelectedCount([Έτος])=1,'Stock Value ' & GetFieldSelections ([Έτος],','),
If(getSelectedCount([Έτος])=2,'Stock Value ' & GetFieldSelections ([Έτος],','),
If(getSelectedCount([Έτος])=3,'Stock Value ' & GetFieldSelections ([Έτος],','),
If(getSelectedCount([Έτος])=4,'Stock Value ' & GetFieldSelections ([Έτος],','),
If(getSelectedCount([Έτος])=5,'Stock Value ' & GetFieldSelections ([Έτος],','),
If(getSelectedCount([Έτος])=6,'Stock Value ' & GetFieldSelections ([Έτος],','),
'ALL'))))))
Where Έτος means year, and i did 6 ifs because max value of years are 7 (2017,2018,2019,2020,2021,2022,2023)
If you can suggest a shorter query, it would be much appreciated !