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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Need to do sum based on group by value

Hi Team,

I have data like below, i wanted do sum(sales) where i dont want to include sales to result values when sum(proft,on product)=0.

In the below Sum(sales)=85822728

but when sum(profit)=0 on product-wise, then want to exclude those sales.

so according to condition my sales needs to be : 50396631. (Note Here Prod-B, Prod-D, Prod-F wise sum(profit)=0, so i am excluding those products related Sales)

Note: i dont want to see result with the fields( ID, Category, Sales, Profit) filled in resulted pivot table

(Consider "Sheet-to-be-considered" for pivot creation)

Example source is showed below:

IdProductCategorySalesProfit
14Prod-AX16083106756
435Prod-BY4033646-2000
815Prod-CY96599597445
198Prod-AZ5283048876875
786Prod-AX7678475764764
540Prod-CY66706756767
50Prod-BZ861982543000
796Prod-CX416943877
60Prod-CX24745608756
858Prod-AX6679131875
729Prod-CY3108168849
918Prod-BZ1167124-3544
22Prod-BX4478197-37456
405Prod-AY68173626738
187Prod-DY6288128-1000
861Prod-FZ9029374350
488Prod-DY6913681-250
420Prod-FA5303154-350
71Prod-DY8819191250

Result would be like below in pivot attached copy.

1 Solution

Accepted Solutions
sunny_talwar

May be try this:

Sum({<Product = {"=Sum(Profit) <> 0"}>}Sales)

View solution in original post

1 Reply
sunny_talwar

May be try this:

Sum({<Product = {"=Sum(Profit) <> 0"}>}Sales)