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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
deepakqlikview_123
Specialist
Specialist

Expression

Hi All,

Can you please tell me how below expression will work.

dual(count(distinct EnquiryID)/1000 & ' (' & num((count(distinct EnquiryID)/count(distinct total EnquiryID)), '0.00%') & ')', count(distinct EnquiryID)

Thanks,

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

Dear Deepak,

Let me explain you in brief...

Consider the enclosed file showing dummy sales of few customers.

Table 1 : showing customer vs Sales... You can sort the data by clicking on Sales Column

Table 2 : showing customer vs %SalestoTotal. Here also you can sort the data.

Table 3:  Now consider that you want to show Sales & % sales together in an expression...

              Sales = SUM(Sales)
              % Sales = SUM(Sales)/SUM(Total Sales)

              As you can see that 1st is having Number and 2nd is having % format, you can't use the number tab.

              This can be achieved using NUM(YourExpression, '#,##0.00') and NUM(YourExpression, '#,##0.00%')

              to separate these two expression we can use

              1st Expression &' (' & 2nd Expression &')'

              But now question is how to sort by SUM(Sales) by simply clicking on the Column.

Table 4: This can be achieved using Dual Funciton.

            Dual function is Creating a forced association between a string (1st Expression) and a number (2nd Expression)

Hope this helps...

View solution in original post

9 Replies
Not applicable

it displays the average count of Enquiry id as per the dimention versus the total count of enquiryID ignoring all the dimensions and the result is concatenated into a text enclosed within brackets, and you have the numerical count as well as part of the dual.

deepakqlikview_123
Specialist
Specialist
Author

I have ques as per below,

How & ' (' & will work

What is use of Dual in above expression

Thanks

Not applicable

& is for concatenation.

Dual is typically for dual purpose. You have the text value as well as the numeral. If you want to use the expression in a list box or a dimension of a chart for example, it will use the text value. If you use it in an expression it will use the numeral value that is the second argument.

A typical example will be a month, you can have a text value of 'Jan' and also a numeral of 1.

Thanks,

Ram

MK_QSL
MVP
MVP

Dear Deepak,

Let me explain you in brief...

Consider the enclosed file showing dummy sales of few customers.

Table 1 : showing customer vs Sales... You can sort the data by clicking on Sales Column

Table 2 : showing customer vs %SalestoTotal. Here also you can sort the data.

Table 3:  Now consider that you want to show Sales & % sales together in an expression...

              Sales = SUM(Sales)
              % Sales = SUM(Sales)/SUM(Total Sales)

              As you can see that 1st is having Number and 2nd is having % format, you can't use the number tab.

              This can be achieved using NUM(YourExpression, '#,##0.00') and NUM(YourExpression, '#,##0.00%')

              to separate these two expression we can use

              1st Expression &' (' & 2nd Expression &')'

              But now question is how to sort by SUM(Sales) by simply clicking on the Column.

Table 4: This can be achieved using Dual Funciton.

            Dual function is Creating a forced association between a string (1st Expression) and a number (2nd Expression)

Hope this helps...

deepakqlikview_123
Specialist
Specialist
Author

Thanks manish for giving me explanation

Anonymous
Not applicable

Hello Manish:

I am trying to use your suggestion for formatting of a number and a percentage in a dual expression.  The expression is as follows:

=dual( Sum([OMAFee]) & '    (' & num((Sum([OMAFee]))/Sum(Total [OMAFee])), '##.0#') & ')',

Sum([OMAFee]) + (sum[OMAFee))/(Sum(Total [OMAFee]))/100 )

The preceding gives me Bar Chart values that look like: Anaesthesia         40426.31 (2.1%)

I am using QV Personal Edition and cannot read foreign .qvw files.  Can you give me the expression for changing the preceding output so that I get the $ value edited correctly as: $40,426.31

Thanks very much

David

MK_QSL
MVP
MVP

Try

=dual( Money(Sum([OMAFee]),'$#,##0.00') & '    (' & num((Sum([OMAFee]))/Sum(Total [OMAFee])), '##.0#') & ')',

Sum([OMAFee]) + (sum[OMAFee))/(Sum(Total [OMAFee]))/100 )

For the question, asked in this thread, we can do like below...

DUAL(MONEY(SUM(Sales),'$#,##0.00') & ' ('&NUM(SUM(Sales)/SUM(TOTAL Sales),'#,##0.00%')&')',NUM(SUM(Sales)))

Anonymous
Not applicable

Hi Manish:

Thanks for your suggestion.  It works just fine and helps me to learn something good every day!!

I am much obliged

David

MK_QSL
MVP
MVP

My pleasure...

Happy Qliking!!!