Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Save the Date: QlikWorld Online, June 24-25, 2020. Free global virtual event for data integration and data analytic gurus. Register Today
Highlighted
New Contributor II

What Data format is needed to get correct percent values in Pivot table chart.

Hi,

I have used this below given formula to calculate the percent and added the field as expression in pivot table.

margin/Freight *100 as GM%

So, the calculation is correct for some values only.

The format used is integer and expression is sum(GM%).

PFA screenshot of my pivot where I've marked the wrong values in red and right ones in green.

Thanks

11 Replies
Highlighted

Re: What Data format is needed to get correct percent values in Pivot table chart.

Are you calculating like this?

margin / (Freight * 100) ???

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Highlighted
New Contributor II

Re: What Data format is needed to get correct percent values in Pivot table chart.

No, (margin/freight) * 100.

Highlighted
Valued Contributor II

Re: What Data format is needed to get correct percent values in Pivot table chart.

Use margin/Freight in the expression and format the field like below

sample.PNG

Highlighted

Re: What Data format is needed to get correct percent values in Pivot table chart.

So, you can play with number format or else please post QVW to test

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Highlighted
New Contributor II

Re: What Data format is needed to get correct percent values in Pivot table chart.

I want to divide with the value in the freight column so count(freight) work right?

Highlighted
Valued Contributor II

Re: What Data format is needed to get correct percent values in Pivot table chart.

Yeah, It will work

Highlighted
MVP
MVP

Re: What Data format is needed to get correct percent values in Pivot table chart.

Using "naked" fields in the front end can lead to unexpected results. Fields in front end expressions should normally be inside an aggregation function of some kind. Perhaps

     Sum(margin) / Sum(Freight)

     or

     Sum(margin / Freight)

Use Aggregation Functions!

And then use % format to display the values as a $

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Highlighted
New Contributor II

Re: What Data format is needed to get correct percent values in Pivot table chart.

Tried this, but values r same as that in the screenshot.

Highlighted
Valued Contributor II

Re: What Data format is needed to get correct percent values in Pivot table chart.

Share  sample data to work