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
antoniosantos
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.

 

antoniosantos_0-1700618232798.png

 

Thanks in advance!

Antonio

 

1 ACCEPTED SOLUTION

Hi @antoniosantos ,

 

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:

vrzhoumsft_1-1700794498578.png

vrzhoumsft_2-1700794509095.png

Result is as below.

vrzhoumsft_0-1700794448383.png

 

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.

View solution in original post

4 REPLIES 4
amitchandak
Super User
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] 

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!

Hi @antoniosantos ,

 

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:

vrzhoumsft_1-1700794498578.png

vrzhoumsft_2-1700794509095.png

Result is as below.

vrzhoumsft_0-1700794448383.png

 

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.

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

 

Cheers,

Antonio

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.