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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
Anonymous
Not applicable

Multiple IF Calculation

Hello,

 

I have two datasets as follows:

 

Dataset 1

IDErect HoursDismantle Hours
11020
2510

 

Dataset 2 

IDJob Type% CompleteBurned
1Erect100%12
2Erect100%5
2Dismantle100%10
2Day Work Mod 5
2Star Rate Mod100%4.5

 

Relationship has been created between ID in both datasets. 

 

I need to create a DAX measure as follows:

 

If job type is 'Erect' then (% complete * erect hours) 
If job type is 'Dismantle' then (% complete * dismantle hours) 

If job type is 'Star Rate Mod' then (% complete * 4.5)

If job type is 'Day Work Mod' then (sum burned)

 

Is the above logic possible in one DAX statement?

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , A new column in dataset2

 

new column =

var _1 = sumx(filter(dataset1, dataset1[ID] = dataset2[ID]) ,[Erect Hours])

var _2 = sumx(filter(dataset1, dataset1[ID] = dataset2[ID]) ,[Dismantle Hours])

return

Switch([Job Type],

"Erect", [% complete]*_1,

"Dismantle", [% complete]*_2,

"Star Rate Mod", [% complete]*.45,

"Dismantle", [Burned]

)

 

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

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , A new column in dataset2

 

new column =

var _1 = sumx(filter(dataset1, dataset1[ID] = dataset2[ID]) ,[Erect Hours])

var _2 = sumx(filter(dataset1, dataset1[ID] = dataset2[ID]) ,[Dismantle Hours])

return

Switch([Job Type],

"Erect", [% complete]*_1,

"Dismantle", [% complete]*_2,

"Star Rate Mod", [% complete]*.45,

"Dismantle", [Burned]

)

 

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
Anonymous
Not applicable

Thanks for answering my questions.

 

Is there anyway I can use the below formular but reference columns from another table in the highlighted section of your code?

 

new column =

var _1 = sumx(filter(dataset1, dataset1[ID] = dataset2[ID]) ,[Erect Hours])

var _2 = sumx(filter(dataset1, dataset1[ID] = dataset2[ID]) ,[Dismantle Hours])


These highlighted columns come from another table that is connect via a many to many relationship. 

 

Many thanks,

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors
Top Kudoed Authors