Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Fidzi8
Helper IV
Helper IV

Percentage difference - empty cells

Hi,
I would need advice.

procenta.png
How to fix to get -3.27%? I don't want to count empty cells.

Thank you
Ondřej

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

Hi @Fidzi8 ,

 

Create a measure as below:

_Measure = 
var _diff=DIVIDE(CALCULATE(SUM('Table (2)'[Cost/tn 21])-SUM('Table (2)'[Cost/tn 20]),FILTER('Table (2)','Table (2)'[Category]=MAX('Table (2)'[Category]))),SUM('Table (2)'[Cost/tn 20]))
var _totalfor21=CALCULATE(SUM('Table (2)'[Cost/tn 21]),NOT(ISBLANK('Table (2)'[Cost/tn 20])),ALL('Table (2)'))
var _totalfor20=CALCULATE(SUM('Table (2)'[Cost/tn 20]),NOT(ISBLANK('Table (2)'[Cost/tn 21])),ALL('Table (2)'))
Return
IF(ISINSCOPE('Table (2)'[Category]),_diff,DIVIDE(_totalfor21-_totalfor20,_totalfor20))

And you will see:

 

v-kelly-msft_0-1610339782398.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

View solution in original post

2 REPLIES 2
v-kelly-msft
Community Support
Community Support

Hi @Fidzi8 ,

 

Create a measure as below:

_Measure = 
var _diff=DIVIDE(CALCULATE(SUM('Table (2)'[Cost/tn 21])-SUM('Table (2)'[Cost/tn 20]),FILTER('Table (2)','Table (2)'[Category]=MAX('Table (2)'[Category]))),SUM('Table (2)'[Cost/tn 20]))
var _totalfor21=CALCULATE(SUM('Table (2)'[Cost/tn 21]),NOT(ISBLANK('Table (2)'[Cost/tn 20])),ALL('Table (2)'))
var _totalfor20=CALCULATE(SUM('Table (2)'[Cost/tn 20]),NOT(ISBLANK('Table (2)'[Cost/tn 21])),ALL('Table (2)'))
Return
IF(ISINSCOPE('Table (2)'[Category]),_diff,DIVIDE(_totalfor21-_totalfor20,_totalfor20))

And you will see:

 

v-kelly-msft_0-1610339782398.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

amitchandak
Super User
Super User

@Fidzi8 , depend on formula, Share the formula and what are the group columns

Refer: https://www.youtube.com/watch?v=ufHOOLdi_jk

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.