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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
shad_fz
Regular Visitor

Perfect Difference Bar Chart

 
Hi All,

 

I am very new to Power BI. I was wondering if there is a way to measure the percent different between planned and actual hours in the in the following chart? Thanks.

 

PowerBI.JPG

 

 

 

 

 

 

1 ACCEPTED SOLUTION
RahulYadav
Resolver II
Resolver II

Hi @shad_fz,

Follow below steps for calculating percentage difference.

 

1. Add New Column "Planned Hours"

Planned Hours = if('Planned Vs Actual'[Planned or Actual Hours]="Planned",'Planned Vs Actual'[Total Hours],0)

2. Add New Column "Actual Hours"

Actual Hours = if('Planned Vs Actual'[Planned or Actual Hours]="Actual",'Planned Vs Actual'[Total Hours],0)

3. Create a new Quick Measure. Right Click on Table name & select New Quick Measure

       a. Select "Percentage Difference" under "Mathematical Operations".

       b. Drag "Planned Hours" column to "Base Value".

       c. Drag "Actual Hours" column to "Value to compare"

       d. Blanks: Treat as zero in the calculation

 

4. This will add below measure to the table.

Actual Hours % difference from Planned Hours = 
VAR __BASELINE_VALUE = SUM('Planned Vs Actual'[Planned Hours])
VAR __VALUE_TO_COMPARE = SUM('Planned Vs Actual'[Actual Hours])
RETURN
	DIVIDE(__VALUE_TO_COMPARE - __BASELINE_VALUE, __BASELINE_VALUE)

2018-03-28_12-30-17.jpg

 

Please let me know if it helps.

 

Thanks,

Rahul

View solution in original post

2 REPLIES 2
MFelix
Super User
Super User

Hi @shad_fz,

 

Although the solution provided by @RahulYadav it's a good solution it will add upp to increase your model in size because every calculated column you add to your model it will add size and complexety to your data.

 

This can be solved making use of a measure for all the parts of @RahulYadav solution add this measure to your model:

 

Actual Hours % difference from Planned Hours =
VAR BASELINE_VALUE =
    CALCULATE (
        SUM ( 'Planned Vs Actual'[Planned Hours] ),
        'Planned Vs Actual'[Planned or Actual Hours] = "Planned"
    )
VAR VALUE_TO_COMPARE =
    CALCULATE (
        SUM ( 'Planned Vs Actual'[Actual Hours] ),
        'Planned Vs Actual'[Planned or Actual Hours] = "Actuals"
    )
RETURN
    DIVIDE ( VALUE_TO_COMPARE - BASELINE_VALUE, BASELINE_VALUE )

 

As you can see this measure calculates the planned / actuals hours and based on context so it will be calculated at each update.

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





RahulYadav
Resolver II
Resolver II

Hi @shad_fz,

Follow below steps for calculating percentage difference.

 

1. Add New Column "Planned Hours"

Planned Hours = if('Planned Vs Actual'[Planned or Actual Hours]="Planned",'Planned Vs Actual'[Total Hours],0)

2. Add New Column "Actual Hours"

Actual Hours = if('Planned Vs Actual'[Planned or Actual Hours]="Actual",'Planned Vs Actual'[Total Hours],0)

3. Create a new Quick Measure. Right Click on Table name & select New Quick Measure

       a. Select "Percentage Difference" under "Mathematical Operations".

       b. Drag "Planned Hours" column to "Base Value".

       c. Drag "Actual Hours" column to "Value to compare"

       d. Blanks: Treat as zero in the calculation

 

4. This will add below measure to the table.

Actual Hours % difference from Planned Hours = 
VAR __BASELINE_VALUE = SUM('Planned Vs Actual'[Planned Hours])
VAR __VALUE_TO_COMPARE = SUM('Planned Vs Actual'[Actual Hours])
RETURN
	DIVIDE(__VALUE_TO_COMPARE - __BASELINE_VALUE, __BASELINE_VALUE)

2018-03-28_12-30-17.jpg

 

Please let me know if it helps.

 

Thanks,

Rahul

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.