Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
YannDV
Frequent Visitor

Change formulas variables in an user friendly way without modifying the formula

Hi! 

 

 I am currenlty building a power bi dashboard for a profitability report and I was wondering if it was possible to change a formula in an user freindly way. Let me explain you what I mean by a concrete example. 

I have 4 different types of costs, called CM, CM1, CM2, CM3. 

The total of these cost is the total cost of a product. 

Each cost is calculated from a different formula, for example 

- CM = Raw Materials + Mold + Energy 

- CM1 = Payroll Employees+ Packaging

 

I would like to know if there could be an easy way for the final user to change the variable, for example :

=> User wants to put packaging in CM

and therefore have =

-CM = Raw materials+Mold+Energy+Packaging 

-CM1 = Payroll Employees

 

But without having change the formulas in power bi. 

Do you think it is possible ? 


Thank you a lot and I wish you a good day 

1 ACCEPTED SOLUTION
ValtteriN
Super User
Super User

Hi,

You could use either multiple slicer tables or one and utilize EXCEPT.

Start data:

'MaterialCostTable'

ValtteriN_0-1641377105162.png

'Slicer CM1'

ValtteriN_1-1641377145449.png

Data model:

ValtteriN_2-1641377167023.png


Dax:

CM1 = CALCULATE(SUM(MaterialCostTable[Cost]),
USERELATIONSHIP('Slicer CM1'[Material],MaterialCostTable[Material]))

 

CM2 = CALCULATE(SUM(MaterialCostTable[Cost]),
USERELATIONSHIP('Slicer CM2'[Material],MaterialCostTable[Material]))



CM2 Alternate = CALCULATE(SUM(MaterialCostTable[Cost]),
EXCEPT(all('Slicer CM1'[Material]),ALLSELECTED('Slicer CM1'[Material])),
//If you use this method you can have active relationship between the slicer and remove USERELATIONSHIP here
USERELATIONSHIP('Slicer CM1'[Material],MaterialCostTable[Material]))



End result:

ValtteriN_3-1641377301541.png


Explanation:
So in my example I have to different ways of doing this. You can use multiple slicers (as seen on the picture) and select each cost you want to include in the calculation. 
The second option is to use one slicer and in this alternate example [CM2 alternate] includes all of the selections not selected in CM1 slicer (As you can see CM2 and CM2 alternate return the same result using different method).

I hope this helps to solve your issue and if it does consider accepting this as a solution and giving the post a thumbs up! 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
ValtteriN
Super User
Super User

Hi,

You could use either multiple slicer tables or one and utilize EXCEPT.

Start data:

'MaterialCostTable'

ValtteriN_0-1641377105162.png

'Slicer CM1'

ValtteriN_1-1641377145449.png

Data model:

ValtteriN_2-1641377167023.png


Dax:

CM1 = CALCULATE(SUM(MaterialCostTable[Cost]),
USERELATIONSHIP('Slicer CM1'[Material],MaterialCostTable[Material]))

 

CM2 = CALCULATE(SUM(MaterialCostTable[Cost]),
USERELATIONSHIP('Slicer CM2'[Material],MaterialCostTable[Material]))



CM2 Alternate = CALCULATE(SUM(MaterialCostTable[Cost]),
EXCEPT(all('Slicer CM1'[Material]),ALLSELECTED('Slicer CM1'[Material])),
//If you use this method you can have active relationship between the slicer and remove USERELATIONSHIP here
USERELATIONSHIP('Slicer CM1'[Material],MaterialCostTable[Material]))



End result:

ValtteriN_3-1641377301541.png


Explanation:
So in my example I have to different ways of doing this. You can use multiple slicers (as seen on the picture) and select each cost you want to include in the calculation. 
The second option is to use one slicer and in this alternate example [CM2 alternate] includes all of the selections not selected in CM1 slicer (As you can see CM2 and CM2 alternate return the same result using different method).

I hope this helps to solve your issue and if it does consider accepting this as a solution and giving the post a thumbs up! 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thank you very much! Perfect solution! What a master 😍

amitchandak
Super User
Super User

@YannDV , No, I do not think viewers can create an on-the-fly measure.

Use can create new measures in Edit mode if they have access.

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.