Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
jatin222kolhe
Contributor II
Contributor II

Showing NA instead of hyphen in pivot table in Qliksense

Hi,

We have created a pivot table which has country and yearmonth as dimensions where yearmonth will be columns.

Our expression is if( len(concat(KPI))>0, count(KPI),'NA').

The result we get is it table shows NA if KPI values doesnt exists for any Yearmonth and country but for one

country , it is not showing NA but showing Hyphen  for few months.

We are not sure what this issue can be.

 

Same scenario for another pivot table but in the other table it not showing NA at all even after using similar expression as above.

Labels (2)
1 Solution

Accepted Solutions
MatheusC
Specialist
Specialist

Hi @jatin222kolhe 

You are certainly getting null values ​​due to the crossing of information contained in the table, with Country, Month/Year and Its Measurement, as @Firefly_cam  already mentioned.

Qlik has made a new pivot table available in the February 2024 version, which makes this treatment simple. If you are on this version, it can be found under Custom Objects.

https://help.qlik.com/pt-BR/sense/February2024/Subsystems/Hub/Content/Sense_Hub/Visualizations/Visua...

MatheusC_2-1716229824655.png


There is also the Vizlib extension, if you have the possibility to work with extensions, this is also an alternative.


Regarts, Matheus

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!

View solution in original post

6 Replies
SunilChauhan
Champion II
Champion II

try to replace Expression with below

 if( len(concat(KPI))>0 or  isnull(KPI)=0  or Trim(KPI) <> '', count(KPI),'NA').

or explore below link for implementing at app level 

 

https://help.qlik.com/en-US/sense/February2024/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptRegu... 

Sunil Chauhan
TauseefKhan
Creator III
Creator III

Hi @jatin222kolhe,
To display 'NA' instead of a hyphen, you can modify your expression to handle null values explicitly. 

Check this both will work:

=If(Len(Concat(DISTINCT KPI)) > 0, Count(DISTINCT KPI), 'NA')

OR
=If(Len(Concat(KPI)) > 0, Count(KPI), If(IsNull(Count(KPI)), 'NA', Count(KPI)))


** When applicable please mark the correct/appropriate replies as "solution". Please LIKE threads if the provided solution is helpful to. **

Firefly_cam
Partner - Contributor III
Partner - Contributor III

This happens because there is no association between Country and YearMonth in Data Model. And no formula can cover this absence.
There are 2 options here:
1) cover the associations with missing data in Data Model (if there is no combination of Country-YearMonth, need to create it)
2) go through synthetic dimension which is pretty heavy and consuming:
Put as your Country dimension in Pivot:

 

=Valuelist($(=Concat(Distinct CHR(39)&Country&CHR(39),','))) 

 

Then your measure will be

 

Pick(Match(Country,Valuelist($(=Concat(Distinct CHR(39)&Country&CHR(39),','))))+1,'NA',count(KPI))

 

 

Regards, Roman
MatheusC
Specialist
Specialist

Hi @jatin222kolhe 

You are certainly getting null values ​​due to the crossing of information contained in the table, with Country, Month/Year and Its Measurement, as @Firefly_cam  already mentioned.

Qlik has made a new pivot table available in the February 2024 version, which makes this treatment simple. If you are on this version, it can be found under Custom Objects.

https://help.qlik.com/pt-BR/sense/February2024/Subsystems/Hub/Content/Sense_Hub/Visualizations/Visua...

MatheusC_2-1716229824655.png


There is also the Vizlib extension, if you have the possibility to work with extensions, this is also an alternative.


Regarts, Matheus

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!
Firefly_cam
Partner - Contributor III
Partner - Contributor III

Thanks for mentioning this new feature. I was certain that I’ve seen this, but couldn’t find in which release)

Regards, Roman
jatin222kolhe
Contributor II
Contributor II
Author

Hi,

Since in the data model, we dont have those yearmonths for those countries, we are not able to show  NA even after trying multiple ways.

So it seems there are 3 ways:

1)we can populate the missing year months for those countries in the data model along with the primary key which will increase the no of rows(in millions) and can affect the applications performance.

Also it will show wrong values in charts if we are counting the primary key itself.

2)using vizlib pivot table which has option to replace hyphen with NA or

3)using the pivot table in latest qlik release which you mentioned which has option to replace hyphen with NA