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

Announcements
Register by January 31 for $300 off your Qlik Connect pass: Register Now!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

query

is there is any other way to write this expression

=IF(WildMatch(Batch_Char_New,'A*','M*') ,vROAD_PMT,

IF(WildMatch(Batch_Char_New,'R*') ,vRAIL_PMT))

where  vROAD_PMT

=([vSales_Qty(InLacs)] * sum([Road PMT_ROAD_PMT]))

+(([vSales_Qty(InLacs)]) * sum([ZCFA_INV_Road PMT_ROAD_PMT]))

vRAIL_PMT

=(([vSales_Qty(InLacs)]) * sum([Rail PMT_RAIL_PMT]))+

(([vSales_Qty(InLacs)]) * sum([ZCFA_INV_Rail PMT_RAIL_PMT]))

3 Replies
jagan
Partner - Champion III
Partner - Champion III

HI,

Try like this

=IF(WildMatch(Batch_Char_New,'A*','M*') ,vROAD_PMT,

IF(WildMatch(Batch_Char_New,'R*') ,vRAIL_PMT))

where  vROAD_PMT

=(sum([Road PMT_ROAD_PMT]) + sum([ZCFA_INV_Road PMT_ROAD_PMT])) * [vSales_Qty(InLacs)]

vRAIL_PMT

=(sum([Rail PMT_RAIL_PMT]) + sum([ZCFA_INV_Rail PMT_RAIL_PMT])) * [vSales_Qty(InLacs)]

Regards,

Jagan.

ToniKautto
Employee
Employee

It is always to hard to recommend the best possible way of setting up logic with a sample with data. The data model structure will usually decide the most efficient way of doing things.

What is the problem with your current expression? You get incorrect results or is it slow? Why do you want to write it differently?

jagan
Partner - Champion III
Partner - Champion III

Or you can try this using Set Analysis without If()

=RangeSum(vROAD_PMT, vRAIL_PMT)

where  vROAD_PMT

=(sum({<Batch_Char_New={'A*','M*'}>}[Road PMT_ROAD_PMT]) + sum({<Batch_Char_New={'A*','M*'}>} [ZCFA_INV_Road PMT_ROAD_PMT])) * [vSales_Qty(InLacs)]

vRAIL_PMT

=(sum({<Batch_Char_New={'R*'}>} [Rail PMT_RAIL_PMT]) + sum({<Batch_Char_New={'R*'}>} [ZCFA_INV_Rail PMT_RAIL_PMT])) * [vSales_Qty(InLacs)]