cancel
Showing results for
Did you mean:

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

Frequent Visitor

## How to add a column showing the % variance between that row's value and the table's bottom avg?

Hi!

I have been struggling to get this one done and I need you help! 🙂

The table below should have an additional column showing the difference between 3,35 (first row, for example) and 3,36 (bottom avg) in %.

I have tried the quick measures, but none of them seems to help.

Antonio

1 ACCEPTED SOLUTION
Community Support

I think you can try to add an IF() function in your code.

``````diff =
IF([Qtd/Und]<>BLANK(),CALCULATE([Qtd/Und],ALLSELECTED()) - [Qtd/Und])``````

My Sample:

Result is as below.

Best Regards,
Rico Zhou

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

4 REPLIES 4
Super User

@antoniosantos , Your measure is [QTD Media/Und]

Try a measure like

diff= calculate( [QTD Media/Und] , allselected())  - [QTD Media/Und]

or

diff= calculate( [QTD Media/Und] , allselected(DataTable))  - [QTD Media/Und]

Frequent Visitor

Thanks a lot for the suggestions. However, if I try

``diff= calculate( [QTD Media/Und] , allselected())  - [QTD Media/Und] ``

It expands the table, showing previous dates that are not within the selected ones via slicer.

if I do:

``diff= calculate( [QTD Media/Und] , allselected(DataTable))  - [QTD Media/Und] ``

It shows the result on a row by row basis, showing 0 because they are similar, while it should compare with the value at the bottom.

Thank you!

Community Support

I think you can try to add an IF() function in your code.

``````diff =
IF([Qtd/Und]<>BLANK(),CALCULATE([Qtd/Und],ALLSELECTED()) - [Qtd/Und])``````

My Sample:

Result is as below.

Best Regards,
Rico Zhou

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

Frequent Visitor

Thanks for taking the time to understand, despite how trivial this may seem to you!

Cheers,

Antonio

Announcements

#### New forum boards available in Real-Time Intelligence.

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

#### Power BI Monthly Update - May 2024

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

#### Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors