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: 
Not applicable

How to change expression to get MAX ID PLEASE HELP!

Hi,

I Have a expression as below in straight table.

Count(Distinct(ID)) & '    '& NUM(Count(Distinct(ID))/COUNT(TOTAL DISTINCT ID),'#,##0.00%')

Could anyone let me know how can I change the expression to get MAX ID.  I used below one

Count(Distinct MAX(ID)) & '    '& NUM(Count(Distinct MAX (ID))/COUNT(TOTAL DISTINCT MAX (ID),'#,##0.00%')

But this is showing 'Error in Expression'.

Thanks.

29 Replies
Not applicable
Author

will this work?

Count(Distinct MAX(ID)) & '    '& NUM(Count(Distinct MAX (ID))/COUNT(TOTAL DISTINCT MAX (ID),'#,##0.00%')

manideep78
Partner - Specialist
Partner - Specialist

Can you please try the below expression

=Count({<ID={"$(=Max(ID))"}>}Distinct ID)&' '& Num(Count({<ID={"$(=Max(ID))"}>}Distinct ID)/Count({<ID={"$(=Max(ID))"}>}TOTAL ID),'#,##0.00%')

Hope this helps

Regards

Manideep

sujeetsingh
Master III
Master III

You can not use Max in count i think.

you can try Set analysis or variable as

    vMaxID=MAX(ID)

and then use this variable in count function

Not applicable
Author

Thanks

Actually I have two dimensions

Persons and Team

when I used the above expression it is showing only one person and one team and the count of that person and team.

It is not showing all dimension values. Do I need to change anything here?


Not applicable
Author

Then what is the solution for this?

Not applicable
Author

Could you post the sample data and the expected results?

manideep78
Partner - Specialist
Partner - Specialist

Try this for above result

=Count({<ID={"=Max(ID)"}>}Distinct ID)&' '& Num(Count({<ID={"=Max(ID)"}>}Distinct ID)/Count({<ID={"=Max(ID)"}>}TOTAL ID),'#,##0.00%')

Regards

Manideep

MK_QSL
MVP
MVP

Count(Distinct Aggr(MAX(ID),Persons, Team)) & '    '& NUM(Count(Distinct Aggr(MAX (ID),Persons, Team))/COUNT(TOTAL DISTINCT Aggr(MAX (ID),Persons, Team),'#,##0.00%')

Not applicable
Author

Thanks and it is showing correct values only for one person and all the remaining it is showing incorrect values.