Forum Discussion
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 | Revenue | Difference | |||
| Car | Audi | $ 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 | $ - | |||
| Door | 300 | ||||
| Tyres | 500 | ||||
| Engine | $ 2.500,00 | ||||
| Window | $ 1.200,00 |
Hi Anonymous
You can try this measure
difference = IF(COUNTBLANK('Table'[Revenue]) > 0, BLANK(), SUM('Table'[Revenue])-SUM('Table'[Cost]))Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
1 Reply
- v-jingzhangCommunity Support
Hi Anonymous
You can try this measure
difference = IF(COUNTBLANK('Table'[Revenue]) > 0, BLANK(), SUM('Table'[Revenue])-SUM('Table'[Cost]))Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.