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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
FrancescoSCP
Helper IV
Helper IV

Parameters to calculate custom values for some categories

Hi all,

 

i have a table like this:

 

activity   hour   value

A            2         10

B            3          15

C            4           20

 

By default value is calculated hour*5.

My goal is to set some parameters (or custom table) to multiply hour with a different cost for each activity.

For example hourly cost for activity A to 20, so value has to be 40.

For activity B 10 per hour, so value has to be 30. And for activity C default value.

 

The goal is to edit those hourly cost with a parameter (or edit values in a table).

 

Any suggestions?

 

Regards,

Francesco

3 REPLIES 3
v-eachen-msft
Community Support
Community Support

Hi @FrancescoSCP ,

 

You could use SWITCH() function to get a new column or measure:

Column =
SWITCH (
    test[activity],
    "A", test[hour] * 20,
    "B", test[hour] * 10,
    test[hour] * 5
)
Measure =
VAR a =
    SELECTEDVALUE ( test[activity] )
VAR b =
    SELECTEDVALUE ( test[hour] )
RETURN
    SWITCH ( SELECTEDVALUE ( test[activity] ), "A", b * 20, "B", b * 10, b * 5 )

Here is the result.
2-1.PNG

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.
amitchandak
Super User
Super User

Create a table with an hourly cost of the activity.

Join this with this table.

Using lookup value, populate the value in a column for the current table 

https://docs.microsoft.com/en-us/dax/lookupvalue-function-dax

.Create another column to multiply the two

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

Hi,

 

yes it works but the end user cannot edit the hourly cost.

 

The best would be a write back option: with power apps i can only connect to cloud SQL server with my free account. To use data gateway it requires a plan.

 

Any suggestion?

 

Regards,

Francesco

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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