Only compare when both measures have data


I have a chart at the moment that pops out the differences between sales and sales LY. The chart can be viewed across any date period using a slicer as per the techniques in Enterprise DNA. The future forecast is also in the same chart and one minor annoyance at the moment is that if the slicers are set to a future date we can still see a difference for sales and sales LY even though there have been no sales (it shows the full amount of last years sales as the difference).

I am struggling with the DAX to say ‘if there is no sales don’t show a difference( or show the difference as 0)’ My current measure is:

YoY Comparison = [Sales Metric]-[Sales LY]

Can you support on the correction for this?


Should be very easy this one.

You need logic like this

=IF( ISBLANK( Total Sales ), BLANK(), Total Sales - Sales LY )

Something like this.


Thanks Sam - that does the job.