Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago

HELP! Calculating % Difference between two Table Visuals

Hello,

 

I am trying to calculate the % difference between two table visuals.

The table to the left of the red line is filtered differently than the table to the right of the line. These are two different table visuals and is not connected in any way other than pulling from the same main data set. 

 

I want to find the percent difference between Avg. Base Salary and the Market 50th.

 

I tried various DAX formulas like 

 

% DifferenceTEST =
VAR APPLE = IF('Survey Data'[FRUIT] = "APPLE",(AVERAGE('Survey Data'[PRICE]), BLANK())
VAR MARKET = (MEDIAN('Survey Data'[ADJUSTEDPRICE]))
RETURN
DIVIDE(ORG)-(MARKET),(ORG)
 
I have also explored potentially creating a third table but not sure how to referece the two values (Avg. and Median.)
 
The % difference for the first line should be .84% (500,655-496,431)/500,655.

 

This reprot would strictly be exported to PDF and not as excel - hence why I am fine with not creating one set table. 

 

Thanks the the help/advice!

 

 

 

 

 

 

 

1 Reply

  • Hi Anonymous -create measures to calculate the "Avg. Base Salary" and the "Market 50th" values.

    AvgBaseSalary = AVERAGE('Survey Data'[Base Salary])

    Market50th = MEDIAN('Survey Data'[Market 50th])

    create a measure to calculate the % difference between

    PercentDifference =
    VAR AvgBase = [AvgBaseSalary]
    VAR Market = [Market50th]
    RETURN
    DIVIDE(AvgBase - Market, AvgBase)

     

    you can export to pdf >> Go to the File menu in Power BI Desktop."Export to PDF" option is there. 

     

    Hope this helps 

    Did I answer your question? Mark my post as a solution! This will help others on the forum!
    Appreciate your Kudos!!