Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
juliakhaa
Creator
Creator

Percentages in pivot table

Hello all, I can not figure out how to correctly convert the value of the measure in %, as in the example of an Excel table, under the measure I take count(id), I would be grateful for help

I can’t use count(id)/count(total <week> id)

because week -> week(datecreated) & 'week' (' &WeekStart(datecreated) & ' - ' & WeekEnd(datecreated) & ')'

EE9340B2-7469-4AFA-B5EF-D4EE2A02DBF9.png

CBA8CDBB-10FB-48EE-AF52-317BD5F2EA01.jpeg

1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

Use a preceding load , in the data load editor 

Your load script should be as below

Example 

 

Table name:

SQL 

Select X,y,z from somedbtable;

 

Add a preceding load as below 

 

Table name:

LOAD * , Week(Datefield) as week ;

SQL 

Select X,y,z from somedbtable;

 

Reference 

https://help.qlik.com/en-US/qlikview/May2022/Subsystems/Client/Content/QV_QlikView/Scripting/precedi...

 

 

 

 

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

7 Replies
vinieme12
Champion III
Champion III

as below,

 

 count(id)/count(total <Status> id)

 

  WEEK is the ROW Dimension in the PIVOT TABLE   , then  count(TOTAL  <WEEK> Measure)  will return TOTAL FOR ALL ROWS 

 

  STATUS is the COLUMN  Dimension in the PIVOT TABLE   , then  count(TOTAL  <STATUS> Measure)  will return TOTAL BY COLUMNS 

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
juliakhaa
Creator
Creator
Author

Yes, I realized that I need to use week, since it's not just a field, but -> =week(datecreated) & ' week (' &WeekStart(datecreated) & ' - ' & WeekEnd(datecreated) & ')'
It doesn't work in this case -> count(TOTAL  <WEEK> Measure)

vinieme12
Champion III
Champion III

Status is the field you need in this case  NOT Week

 

 count(id)/count(total <Status> id)

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
juliakhaa
Creator
Creator
Author

But then I don’t get what I need 

E73EE227-AF13-4E3B-A6DC-DCA885DEF184.png

vinieme12
Champion III
Champion III

Oops my bad,   you need to create a Week field in your DataModel, 

 

 

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
juliakhaa
Creator
Creator
Author

Sorry, but how can I do this if my script is written in postgresql and this field for week is written in qlik

vinieme12
Champion III
Champion III

Use a preceding load , in the data load editor 

Your load script should be as below

Example 

 

Table name:

SQL 

Select X,y,z from somedbtable;

 

Add a preceding load as below 

 

Table name:

LOAD * , Week(Datefield) as week ;

SQL 

Select X,y,z from somedbtable;

 

Reference 

https://help.qlik.com/en-US/qlikview/May2022/Subsystems/Client/Content/QV_QlikView/Scripting/precedi...

 

 

 

 

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.