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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
ecabanas
Creator II
Creator II

How Could I do this? with calculated dimension

I wanna calculate the number of saleslines that has different profits

Example:

Calculated dimension (sale profit)         Number of orders

less than 0,15                               3

0,15-0,29                                      4

More than 0,29                              5

The formula to calculate the sale profit:

sum({<ESTADO_PEDIDO={'Facturado'},CalendarMonthAndYear=, [Codventa]={'PV0***'}>} IMPORTBRUT)

+

sum({<ESTADO_PEDIDO={'Facturado'},CalendarMonthAndYear=, [Codventa]={'PV0***'}>} Cost)

+

sum({<ESTADO_PEDIDO={'Facturado'},CalendarMonthAndYear=, [Codventa]={'PV0***'}>} CAMPAÑA)

To count the number of orders:

Count(DISTINCT{<CalendarMonthAndYear=,ESTADO_PEDIDO={'Facturado'}, [Codventa]={'PV0***'}>} Codventa)

Thank's

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Your numbers use a comma as decimal separator: ...nta) < 0,29, dual(... The extra comma mucks up the expressions. You could try using quotes around it "0,29"


talk is cheap, supply exceeds demand

View solution in original post

4 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Maybe something like this:

if( aggr(sum({<ESTADO_PEDIDO={'Facturado'},CalendarMonthAndYear=, [Codventa]={'PV0***'}>} rangesum(IMPORTBRUT,Cost,CAMPAÑA)),Codventa) < 0.15
, dual('less than 0,15',1),

if( aggr(sum({<ESTADO_PEDIDO={'Facturado'},CalendarMonthAndYear=, [Codventa]={'PV0***'}>} rangesum(IMPORTBRUT,Cost,CAMPAÑA)),Codventa) <= 0.29, dual('0,15-0,29',2),dual('more than 0,29',3)))


talk is cheap, supply exceeds demand
ecabanas
Creator II
Creator II
Author

Hi Gysbert,

The expression gave me an error and I don't know why?

thank's

=if( aggr(sum({<ESTADO_PEDIDO={'Facturado'},CalendarMonthAndYear=, [Codventa]={'PV0***'}>} rangesum(IMPORTBRUT,Cost,CAMPAÑA)),Codventa) < 0,29, dual('less than 0,29',1),dual('more than 0,29',2))

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Your numbers use a comma as decimal separator: ...nta) < 0,29, dual(... The extra comma mucks up the expressions. You could try using quotes around it "0,29"


talk is cheap, supply exceeds demand
ecabanas
Creator II
Creator II
Author

BRILLIANT!!!!

many thank's!!!