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
Anonymous
Not applicable

Dax solution to calculate Spread or Diference

Hello, I need a solution that helps me calculate the difference between a measure that I created, based on a column I used the following formula to calculate the average of these values ​​when applying some filters on my dashboard
 
Average Ticker = 

AVERAGEX(

    KEEPFILTERS(VALUES('Vol Delta'[UndrlygInstrm])),

    CALCULATE(MEDIAN('Vol Delta'[VoltlyVal])))
 

 

After creating this measure I can create the following graph

 

 

EricAlves_0-1663179713801.png

 

 

After that I would like to create the measure that shows me the difference between these two values ​​​​in the graph

 

An example would be the red line with the value of 25.02% which would be the subtraction of 52.58 - 27.56

 

 

EricAlves_1-1663179856359.png

 

 

How can I make a formula to calculate this difference ?

EricAlves_2-1663179914108.png

 

 

 

1 ACCEPTED SOLUTION
v-rongtiep-msft
Community Support
Community Support

Hi @Anonymous ,

I have created a simple sample, please refer to it to see if it helps you.

Create a measure.

Measure =
VAR _1 =
    CALCULATE (
        MAX ( 'Table'[VALUE] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[subject] = "B"
                && 'Table'[date] = SELECTEDVALUE ( 'Table'[date] )
        )
    )
RETURN
    _1 - MAX ( 'Table'[VALUE] )

vpollymsft_0-1663565373528.png

 

If I have misunderstood your meaning, please provide mor details with your desired and pbix file without privacy inofrmation.

 

Best Regards

Community Support Team _ Polly

 

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

View solution in original post

2 REPLIES 2
v-rongtiep-msft
Community Support
Community Support

Hi @Anonymous ,

I have created a simple sample, please refer to it to see if it helps you.

Create a measure.

Measure =
VAR _1 =
    CALCULATE (
        MAX ( 'Table'[VALUE] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[subject] = "B"
                && 'Table'[date] = SELECTEDVALUE ( 'Table'[date] )
        )
    )
RETURN
    _1 - MAX ( 'Table'[VALUE] )

vpollymsft_0-1663565373528.png

 

If I have misunderstood your meaning, please provide mor details with your desired and pbix file without privacy inofrmation.

 

Best Regards

Community Support Team _ Polly

 

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

Greg_Deckler
Super User
Super User

@Anonymous Well, you could create a measure that does a CALCULATE of that measure with a filter of your legend value and then your other legend value and average the two together. You may also find this helpful as this would be even easier to implement because the original average formula would not include that weird CALCULATE construct.

Better Average per Category - Microsoft Power BI Community


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors