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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Shackwell
Helper III
Helper III

Percentage Difference between a filtered value

Hello once again.

 

I am currently working on a database involving departments and subdepartments. What I am trying to do is to have all departments branched out and would like to input the following measure. I want to be able to see the % of the subdepartment within the department. For example,

 

Whole costs are 100 units and Departament A represents 5 units. Additionally Department A has subdepartments and I would like to know the weight of such subdepartment regarding the Department A. Because right now what I am able to do is to see given percentage but from the sum of the  whole Departments,

Thank you for your time,

3 REPLIES 3
Shackwell
Helper III
Helper III

Thank you for the swift reply. I will try to implement it as soon as I can I just have a question regarding the "//". I'm not sure what that is. 

Hi again Shakwell

 

// are comments.  I recommend that add comments to measure to document them and assist your learning.

 

Please click thumbs up and accept as solution buttons. Thanks 

speedramps_0-1652219958808.png

 

 

speedramps
Super User
Super User

Create this measure

 

Unitpercent =


// get units for sub department
VAR mysubdepartmentunits = 

SUM(yourtable[units])

// get units for department

VAR mydepartmentunits = 

CALCULATE(
SUM(yourtable[units],

ALLEXCEPT[Department]
)


RETURN
DIVIDE(
mysubdepartmentunits , 
mydepartmentunits
)

 

Format unitpercent  as a %

 

Create a visual table with

Department, Subdepartment, units and unitpercent 

 

Please click thumbs up and accept as solution buttons. Thanks 😀

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.