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
Anonymous
Not applicable

Leave sub total empty when rows are empty

Hello everyone,

 

In my matrix table, I compare the cost price (Cost) with the selling price (Revenue) per car, but also per part of the car.  I want to have a measure for the difference between those two columns. It does happen that there are rows empty for the column Revenue. The sub total of the difference should remain empty too, since it doesn't make sense to compare Cost with Revenue with incomplete data. 

 

I would like to have a measure which returns a Blank when this happen. 

I added a sample set below.  The column Difference should be the output of the measure.

Thank you in advance!

 

   Cost RevenueDifference
CarAudi  $           5.800,00 $                       6.400,00 $      600,00
  Door $               500,00 $                          550,00 $        50,00
  Tyres $               800,00 $                          850,00 $        50,00
  Engine $           3.000,00 $                       3.100,00 $      100,00
  Window $           1.500,00 $                       1.900,00 $      400,00
 BMW  $           5.550,00 $                       6.300,00 $      750,00
  Door $               450,00 $                          550,00 $      100,00
  Tyres $               700,00 $                          850,00 $      150,00
  Engine $           3.200,00 $                       3.500,00 $      300,00
  Window $           1.200,00 $                       1.400,00 $      200,00
 Mercedez  $           7.100,00 $                       1.800,00 
  Door $               600,00 $                          800,00 $      200,00
  Tyres $               800,00 $                       1.000,00 $      200,00
  Engine $           4.000,00  
  Window $           1.700,00  
 Ford  $           4.500,00 $                                   -   
  Door300  
  Tyres500  
  Engine $           2.500,00  
  Window $           1.200,00  
1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

You can try this measure

difference = IF(COUNTBLANK('Table'[Revenue]) > 0, BLANK(), SUM('Table'[Revenue])-SUM('Table'[Cost]))

vjingzhang_0-1665729509999.png

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

1 REPLY 1
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

You can try this measure

difference = IF(COUNTBLANK('Table'[Revenue]) > 0, BLANK(), SUM('Table'[Revenue])-SUM('Table'[Cost]))

vjingzhang_0-1665729509999.png

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

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.