Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
pradnyat
Creator
Creator

Issue with number formatting in Line chart

Hi All,

We have 2 measures (Sales, Share) which we are showing dynamically in line chart. These 2 measures have different number formatting which I am handling using below expression:

if(Metric='Share',Num(Share,'#0%'),Num(Sales,'##,#00'))

and changed the number formatting to ;Measure Expression' which is giving correct results in Tooltip like % for Share and Number for sales.

But the Y axis remains same its not changing based on metrics. For share as well its showing number.

Any inputs to solve this issue.

Thanks in advance!

8 Replies
premvihari
Partner - Creator
Partner - Creator

you can achieve it by alternate measures only.
with single expression it was not possible to show 2 different scales for Y axis.

SergeyMak
Partner Ambassador
Partner Ambassador

Hi,

Correct me if I'm wrong, but it looks like you are trying to drive what is displayed on the line chart by toggling in the field. If you do so, than I'd recommend the following approach:

Create or update your Measures table

[Measures]:

LOAD Metric, MetricFormula, Replace(MetricNumFormat,'.', ',') AS MetricNumFormat INLINE [

Metric, MetricFormula, MetricNumFormat

Share, Sum(Share),#.##0%

Sales, Sum(Sales),#.##0

];

Than use the following Expression

NUM($(=MetricFormula),$(=MetricNumFormat))

 

Note: I'm not sure why you don't have an aggregation function for your expression, but it usually required. That's why I've added SUM(). Replace it according to your needs

Regards,
Sergey
pradnyat
Creator
Creator
Author

Yes I tried that but its not changing the values displayed at Y Axis
SergeyMak
Partner Ambassador
Partner Ambassador

Usually it changes Y axis

It would be great if you can post the screenshot.

 

Regards,
Sergey
StarinieriG
Partner - Specialist
Partner - Specialist

Hi

Maybe is not selected automatic format number in measure setting?

pradnyat
Creator
Creator
Author

Attaching the QVF file for reference. Y axis is still not showing the % values, with measure expression in number format I was able to achieve hover number format.

 

Any help will be really appreciated!

Thanks!

pradnyat
Creator
Creator
Author

I have shared the QVF file

crvctsaa
Contributor II
Contributor II

Thanks for the helpful solution @SergeyMak .

I was able to get this to work with a small change to your measure expression, the format part of the nested expression needed to be in single quotes.  

num($(=MetricFormula),'$(=MetricNumFormat)')