Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.
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 | WarehouseLocation | Quantity | 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
Solved! Go to Solution.
Hi @Anonymous,
You can create a what-if parameter and use it as the source of the slicer, then you can write a measure formula based on filter selection and current cost values to calculate.
SELECTEDVALUE function - DAX | Microsoft Docs
Use what-if parameters to visualize variables - Power BI | Microsoft Docs
Regards,
Xiaoxin Sheng
Hi @Anonymous,
You can create a what-if parameter and use it as the source of the slicer, then you can write a measure formula based on filter selection and current cost values to calculate.
SELECTEDVALUE function - DAX | Microsoft Docs
Use what-if parameters to visualize variables - Power BI | Microsoft Docs
Regards,
Xiaoxin Sheng
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 3 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 11 | |
| 9 | |
| 8 | |
| 7 | |
| 6 |