Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Conditional Number Formatting

A question from a newbie here.  I have a chart where I've parameterized the calculation for the value axis.  I let the user choose whether they want to view the frequency of an occurance, the hours lost or the dollar value of that time.  What I'd like to do is to set the number formatting based on that selection.  I believe this can be done right from the expression by using code like the following:

if(ChartMeasure = 'Dollars', num(sum(duration)*75/3600, '$#,##0.00'),

    if(ChartMeasure = 'Frequency', num(count(ent_id), '#,##0'),

        if(ChartMeasure = 'Hours', num(sum(duration)/3600, '#,##0.0 hrs'))

    )

)

and then setting the expression number format settings to "expression default" in the number tab.  However, this doesn't seem to be working as I get the same generic formatting no matter what I select.  I know the if statement is being executed, though, as the numbers come out correct for the calculations.

Any help would be greatly appreciated!

7 Replies
IAMDV
Luminary Alumni
Luminary Alumni

Hi Tim,

Good morning.

Is the formatting set to expression default instead ofInteger or other format type? Please can you upload your QV document withscrambled or sample data? I can work out this for you...

Hope this helps!

Cheers - DV

Not applicable
Author

Sure thing.  Thanks for the help!

Not applicable
Author

Sorry to pester, but were you (or anyone else) able to take a look at the document? 

Thanks again!

johnw
Champion III
Champion III

Using your fast change icon, we can see that the only chart the formatting is failing on is the bar chart.  All your other chart types appear correct.  Even on the bar chart, the pop up values are correct.  Hmmm, maybe I'm remembering older versions of QlikView, but thought there were two checkboxes - text on data point and value on data point.  One was formatted and one wasn't, I think.  Surely that option has moved somewhere else, then, and we just have the wrong options selected?  If we tell it to plot values inside segments, that gets the right formatting.  What's so special about plotting a value at the top of the bar?

Anyway, I'm not finding it.  I supsect there's a checkbox or radio button somewhere in the properties that will make it work, but I also won't be surprised if it's a bug.

Not applicable
Author

John,

I think you're correct that it is a bug in this version.  However, plotting the value inside the segment is a good enough work around.  Thank you very much!

Anonymous
Not applicable
Author

please try this  i think it solved problem of conditional number formatting

num((if(vSelectionButton=1,Sum(expression1)

            ,if(vSelectionButton=2,Sum(expression1)

                 ))),if(vSelectionButton=1,'$ #,##','#,##0.00'))

Reagrds,

Dixit Panchal

qlikdelqbz
Contributor III
Contributor III

unfortunately it still does not work for me. at least in 2018 Nov version.