cancel
Showing results for
Did you mean:
Frequent Visitor

## Calculating DAX Measure (% Deviation) using Name Slicer Value

Good day all,

I am trying to wrap my head around an issue and can't seem to figure it out. Also tried searching different topics and either it didn't work or I didn't understand something in full.

I have created the following Measure:

Fuel per Hour =
VAR Total_Trip_Time =
SUMX(
Flight_Indicators,
HOUR(Flight_Indicators[Actual Trip TIme]) + MINUTE(Flight_Indicators[Actual Trip TIme])/60 + SECOND(Flight_Indicators[Actual Trip TIme])/3600)

VAR Total_Trip_Time_INT =
TRUNC(Total_Trip_Time,2)

VAR Total_Trip_Fuel =
CALCULATE(
SUMX(Flight_Indicators,
Flight_Indicators[Block fuel at TOGA push KG] - Flight_Indicators[Block fuel at TD KG]),
FILTER(Flight_Indicators, Flight_Indicators[Block fuel at TOGA push KG] > 0))
RETURN
DIVIDE(Total_Trip_Fuel, Total_Trip_Time_INT)

In terms of "Slicers", I have a Name Slicer and a Date Slicer

Using the "Card" Visualization I have shown

1) First Card: Amount of fuel/hour based on individual selection from Name Slicer for given Date

2) Second Card: Amount of fuel / hour for given Date (basically "company" value, Name Slicer does not affect this card due to "Edit Interactions" feature)

The measure that I am trying to solve is to find the % Deviation of the individual vs company. I've tried using combinations of CALCULATE with SELECTEDVALUE or FILTER but don't seem to figure it out.

Any information and guide towards the right direction is very much appreciated and I will be happy to give more information if needed

I have also attached an image with the model of the pbix

1 ACCEPTED SOLUTION
Community Support

Hi @ValentinB ,

I have built a simple data sample:

``individual = SUM('Table'[Hour]) ``
``company = CALCULATE(SUM('Table'[Hour]),REMOVEFILTERS('Table'[Name]))``
``% Deviation = ( [individual]-[company]) / [company]``

Output:

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

4 REPLIES 4
Community Support

Hi @ValentinB ,

I have built a simple data sample:

``individual = SUM('Table'[Hour]) ``
``company = CALCULATE(SUM('Table'[Hour]),REMOVEFILTERS('Table'[Name]))``
``% Deviation = ( [individual]-[company]) / [company]``

Output:

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Frequent Visitor

Hello @Eyelyn9 ,

Many thanks for your help, indeed it worked on my side as well. Was not fully aware of the "REMOVEFILTER" function but I am glad I've learned something new.

Best wishes and Happy Holidays !

Super User

@ValentinB , As you want selectedvalue as a benchmark, you need an independent table

So you need an independent company name table and use that in a measure to get that companies value and this should interact with visual

Need of an Independent Table in Power BI: https://youtu.be/lOEW-YUrAbE

New Power BI Features
Datamarts: https://youtu.be/8tskWsJTEpg
Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Dashboard of My Blogs !! Connect on Linkedin !! Proud to be a Super User!
Want To Learn Power BI
Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
!! Subscribe to my youtube Channel !!
Frequent Visitor

Hello @amitchandak ,

I have accepted as a solution @Eyelyn9 method since it worked but I will also check and try to implement your part as I am on a learning curve regarding PowerBi and every intel is a good chance to develop more skills and methods.

Many thanks as well for your reply and wish you also Happy Holidays.

Announcements