Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi there,
I’m working with a product selection filter in QlikApp, and I need the Profit Percentage calculation to adjust dynamically based on the selected product.
If Product A is selected, Profit % should be calculated based on Sales.
If Product B is selected, Profit % should be calculated based on Cost.
What formula can I use to ensure the calculation updates accordingly based on the selection in 'Filter Pan'?
Could you please help, Many thanks!
Product | Sales | Cost | Proft | Profit% |
A | £500 | £200 | £300 | ? |
B | £400 | £100 | £300 | ? |
Try this
=Pick(
Match(Only(Product), 'A', 'B'),
Sum(Profit) / Sum(Sales),
Sum(Profit) / Sum(Cost
)
)
Or
=IF(
GetSelectedCount(Product) = 1,
IF(
Only(Product) = 'A',
Sum(Profit) / Sum(Sales),
IF(Only(Product) = 'B',
Sum(Profit) / Sum(Cost)
)
)
)
Try this
=Pick(
Match(Only(Product), 'A', 'B'),
Sum(Profit) / Sum(Sales),
Sum(Profit) / Sum(Cost
)
)
Or
=IF(
GetSelectedCount(Product) = 1,
IF(
Only(Product) = 'A',
Sum(Profit) / Sum(Sales),
IF(Only(Product) = 'B',
Sum(Profit) / Sum(Cost)
)
)
)