cancel
Showing results for
Did you mean:

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a \$100 discount. Register Now

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
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

2 REPLIES 2
Helper I

100 % eaxactly what I needed thank you!

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

Announcements

#### Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

#### Power BI Monthly Update - February 2024

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

#### Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

#### Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors
Top Kudoed Authors