Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
mstoler
Partner - Specialist
Partner - Specialist

mixing numeric formats in a column

Hello,

I am working on an apparel dashboard where we sell shirts and socks.

For shirts we can to display number quantities.

For socks, we want to display decimals because socks are sold by the dozen and we sometimes sell 0.5 dozen which gets displayed as 1.

Looking for a clever solution for displaying this in a table.

Thank You,

Michael

Labels (1)
  • Chart

1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

for example field Category has values "Shirt", "Socks"

 

Then in chart

Dimension

Category

Measure

=Pick(Wildmatch(Category,'Shirt','Socks')

,num(sum(Qty),'#,##0')

,num(sum(Qty),'#,##0.0')

<< choose formatting as Measure Expression

 

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

View solution in original post

5 Replies
marcus_sommer

Probably there is no solution which you would really like. One simple way would be just to display always with a digit. Another could be to add an unit field into the table and/or into the formatting and showing 0.5 dozen as 6 pieces.

If such approaches aren't wanted you could of course apply an if-loop and querying each time which type is displayed and how does the number look like to branch into different formatting (by larger data-sets it may need some extra time ...).

- Marcus

mstoler
Partner - Specialist
Partner - Specialist
Author

Hello,

Thank you.  The if statement I feel would affect performance.   The table is already large and can take a while to load.

Maybe add a custom format string in the load script and then use the num function?

I might try that. 

Michael

 

 

vinieme12
Champion III
Champion III

for example field Category has values "Shirt", "Socks"

 

Then in chart

Dimension

Category

Measure

=Pick(Wildmatch(Category,'Shirt','Socks')

,num(sum(Qty),'#,##0')

,num(sum(Qty),'#,##0.0')

<< choose formatting as Measure Expression

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
mstoler
Partner - Specialist
Partner - Specialist
Author

Hello,

I am going to extend this idea by storing the format at the item level and then using the only function to get the format into num.

Then use Dimensionality()=0 to show the totals with no decimals. 

Thanks!

Michael

mstoler
Partner - Specialist
Partner - Specialist
Author

Why is it that when you export to excel you get the 'Number stored as text'?

 

Michael