Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Dynamic calculation

Hi team,

 

I have the following structure and need to apply custom calculation= Cost * Quantity depending of slicer selection.

Cost is in one table, Quantity in another table.

The relationship isn't made in PBI beacuse Cost table has always 2 rows for every ProductKey with the scope to avoid duplicate data.

How can we calculate Cost *Quantity having these if any selection for General and for Service.

 

Table slicer:

SiteId     Flag
GENERAL    1
SERVICE    0

 

Table Cost value:

ProductKey SiteId Cost
10 GENERAL 100
10 SERVICE 200
20 GENERAL 300
20 SERVICE 400

 

Table Quantity & expected result to apply:

 

            expected if slicer selection = GENERAL         expected if slicer selection = SERVICE
ProductKey WarehouseLocationQuantity                                           Cost * Quantity
10 120 5    '=100 * 5          '=200*5
10 115 10    '=100*10           '=200*10
20 150 15    '=300*15           '=400*15

 

Please could you please be kind and help.

 

Regards,

Carmen