Quantcast
Channel: Desktop topics
Viewing all articles
Browse latest Browse all 213819

DAX equivalent of NOT EXISTS

$
0
0

I'm trying to figure out how to show rows in a table that do not have corresponding values in another table, while still being able to slice my data.

 

I have a Sales fact table with a store dimension and a time dimension. There's a number of slicers on the store information, slicing by various properties of the store.

 

What I want to do is show Stores that do not have Sales reported. For the life of me, I cannot figure out how to do this.

 

For example, if I slice Store to only show "Category 1" and then slice the time period to only show "July 2016":

  1. I can iobviously quite easily show a table of stores and sales reported.
  2. But I can't seem to figure out how to show a list of all Category 1 stores that have not reported sales

 

I'm new to DAX, so there's likely something basic I'm missing here (I've been trying to understand row/filter contexts and when they get used, but am having trouble visualizing what's active at any given moment in the formula... let alone know where I should be manipulating them).  If I was using SQL, I'd do something like this...

SELECT * FROM Stores WHERE Category='Category 1' AND StoreId NOT IN (SELECT StoreId FROM Sales WHERE Period='201608')

 

So I thought maybe I could use ALLEXCEPT to somehow create a calculated table that achieves this, but have so far been very unsuccessful with understanding how to construct what I want.

 

Any help or guidance would be very much appreciated.

 

Dave

 

 


Viewing all articles
Browse latest Browse all 213819

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>