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
DiegoPerez85
Frequent Visitor

Variation shows -100% for blank cells

Hi! I'm trying to show a table with past year and current year sales and the variation. For some brands where there is no data, the measure I created shows -100%. I would like to only see brands data, hiding the others.

 

This is the measure formula:

 

Var C9L vs LY = SUMX(Variables,Variables[Volume C9 Act (CY)])/SUMX(Variables,Variables[Volume C9 Act (LY)])-1

 

This is the result for blank data

Variation error.png

 

 How can I solve this?

 

Thanks!!!

 

Diego

 

 

2 ACCEPTED SOLUTIONS
dedelman_clng
Community Champion
Community Champion

You'll need to us IF logic to return a blank when there is a blank.  By subtracting 1, you're giving it a value.

 

IF  (SUMX( Variables,Variables[Volume C9 Act (CY)] ) <> 0,
 SUMX(Variables,Variables[Volume C9 Act (CY)])/SUMX(Variables,Variables[Volume C9 Act (LY)])-1,
 BLANK())

 

I would also use DIVIDE instead of the tranditional A/B

 

Hope this helps

David

View solution in original post

Hi! Thanks for your help! I improved the formula and now it's working perfectly. This is how it ended:

 

Var C9L vs LY = IF(DIVIDE(SUMX(Variables,Variables[Volume C9 Act (CY)]),SUMX(Variables,Variables[Volume C9 Act (LY)])) <> BLANK(),(DIVIDE(SUMX(Variables,Variables[Volume C9 Act (CY)]),SUMX(Variables,Variables[Volume C9 Act (LY)]))-1),BLANK())

 

Thanks again!

 

Diego

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Rather than comparing to 0 using <> 0, you could also try using the ISBLANK() function to check if the value is blank. That way, if for some reason your SUM was 0, you would actually show 0, but if it doesn't exist you would show blank.

dedelman_clng
Community Champion
Community Champion

You'll need to us IF logic to return a blank when there is a blank.  By subtracting 1, you're giving it a value.

 

IF  (SUMX( Variables,Variables[Volume C9 Act (CY)] ) <> 0,
 SUMX(Variables,Variables[Volume C9 Act (CY)])/SUMX(Variables,Variables[Volume C9 Act (LY)])-1,
 BLANK())

 

I would also use DIVIDE instead of the tranditional A/B

 

Hope this helps

David

Hi! Thanks for your help! I improved the formula and now it's working perfectly. This is how it ended:

 

Var C9L vs LY = IF(DIVIDE(SUMX(Variables,Variables[Volume C9 Act (CY)]),SUMX(Variables,Variables[Volume C9 Act (LY)])) <> BLANK(),(DIVIDE(SUMX(Variables,Variables[Volume C9 Act (CY)]),SUMX(Variables,Variables[Volume C9 Act (LY)]))-1),BLANK())

 

Thanks again!

 

Diego

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.