Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
gerben_triflex
Contributor
Contributor

Distinct Expression

Hello,

I want the sum of the budget, but the calculation is not right. There are more than 1 of the same K_OPPORTUNITY. So the budget is calculating more then once with the same amount.

Both are fields.

But I don't know how to do this in an Expression.

I have now 

sum ((BUDGET) , distinct K_OPPORTUNITY)

3 Replies
AshutoshBhumkar
Partner - Specialist
Partner - Specialist

Hello,

Any sample data and expected output screens?

 

Thanks,
Ashutosh

jrromito
Contributor II
Contributor II

This should do what it sounds like you are looking for.  

sum(aggr(only(BUDGET),K_OPPORTUNITY))

However, you may want to remodel this on the backend.  Qlik doesn't require that everything be in a flat table, you can pull BUDGET out into its own table and use Opportunity as a key.  This will allow you to sue sum(BUDGET) and also make self-service analytics easier for power users.

gerben_triflex
Contributor
Contributor
Author

The situation is like this.

We have K_Company and this is the main link.

Between Opportunity, there is a table Oppo_COMP how has a field K_COMPANY and K_OPPORTUNITY.

In the Opportunity, there is more than when K_Company. When I filter on a company then I have a good result because there is 1 K_company. But when I look at all of the Opportunities or a selection of the sales manager I have the wrong result. Because I get the Budget of multiple Opportunities because of the multiple K_Compnay on the Opportunities.