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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
bkwohls
Helper I
Helper I

Components Of Costs - Sum selected pieces

My company makes products. For each product we record 3 main components for cost. Burden, Labor, Mtl. I want to analyze our product cost over time BUT also want to be able to use a slicer to select which of teh components are calcualting. For Eaxmple I amy only want to look at MTL over time, or if I select mtl and labor I can also see that. I tried to use the Selected Value but is breaks when more than one item is selected. Thank you in advance

 

This was my attempt:

Roll Up Cost =
Var Burdn = if(SELECTEDVALUE('Cost Type'[Cost Component],blank())="Burden",AAA_Measures[Average Burden],0)
Var Lbor = if(SELECTEDVALUE('Cost Type'[Cost Component],blank())="Labor",AAA_Measures[Average Labor],0)
Var Mtl = if(SELECTEDVALUE('Cost Type'[Cost Component],blank())="Material",AAA_Measures[Average Mtl],0)
Return
Burdn+Lbor+Mtl
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@bkwohls , Try like

Roll Up Cost =
Var Burdn = if(not(isblank(Countx(filter('Cost Type', 'Cost Type'[Cost Component]= "Burden"), 'Cost Type'[Cost Component]))) ,AAA_Measures[Average Burden],0)
Var Lbor = if(not(isblank(Countx(filter('Cost Type', 'Cost Type'[Cost Component]= "Labor"), 'Cost Type'[Cost Component]))) ,AAA_Measures[Average Labor],0)
Var Mtl = if(not(isblank(Countx(filter('Cost Type', 'Cost Type'[Cost Component]= "Material"), 'Cost Type'[Cost Component]))) ,AAA_Measures[Average Mtl],0)
Return
Burdn+Lbor+Mtl

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
bkwohls
Helper I
Helper I

100 % eaxactly what I needed thank you!

 

amitchandak
Super User
Super User

@bkwohls , Try like

Roll Up Cost =
Var Burdn = if(not(isblank(Countx(filter('Cost Type', 'Cost Type'[Cost Component]= "Burden"), 'Cost Type'[Cost Component]))) ,AAA_Measures[Average Burden],0)
Var Lbor = if(not(isblank(Countx(filter('Cost Type', 'Cost Type'[Cost Component]= "Labor"), 'Cost Type'[Cost Component]))) ,AAA_Measures[Average Labor],0)
Var Mtl = if(not(isblank(Countx(filter('Cost Type', 'Cost Type'[Cost Component]= "Material"), 'Cost Type'[Cost Component]))) ,AAA_Measures[Average Mtl],0)
Return
Burdn+Lbor+Mtl

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Solution Authors
Top Kudoed Authors