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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors