Discussion board where members can learn more about Qlik Sense App Development and Usage.
is there a way of dynamically changing a format of a bar chart depending on its values....
some rows of data are for percentages
workers 1008 and some are just number values
when a bar chart is used its formatted for percentages...when the selected apples
however when someone selected workers...its showing in percentage (it would)
is there a way to dynamically change the formatting if a "Format"column was added with eg... number or percentage?
could I use expression formatting code similar to this ? and if yes... is this correct way to do it???
IF(([TargetValue] AND [Format] = 'Percentage')
OR ([TargetValue] AND [Format] = 'Number'), %(), Number())
or can a small drop down be added? users can use on the sheet of the app and just select format percentage or number? this will dynamically change the formatting of the bar chart?
any ideas please?
Go to Solution.
Hi - i did get this to work.
1. Build a 2 row (or more) data island table in the data model with each row determining a 'format code'
if(RowNo()=1,'Percentage','Integer') as Format
2. Build a variable to determine the numeric format based on the selection:
set vFormat='if(Only(Format)=' & chr(39) & 'Integer' & chr(39) &',' &chr(39)& '#,##0' & chr(39) & ',' & chr(39) & '#,##0%' & chr(39) & ')';
3. Invoke the variable in the 2nd argument of the num() function to dynamically determine the format.
change measure expression from:
num( sum(Sales), $(= chr(39) & $(=$(vFormat)) & chr(39)) )
and leave format to 'auto
this code worked amazing, however it does not like below
all I did was create the extra column called format, and said if the row was Percentage or Integer
then used all the rest of the instructions and hay presto.
Thanks so much x