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

Filtering and Count issues

$
0
0

Hi, new to DAX and Powerbi, 

 

I have two tables in a 1:M relationship:

 

TableA (1)

- GUID (key)

- Name

 

TableB: (M)

- ID (key)

- GUID

- TYPE

 

Where type can be 1 or 2

 

I am trying to develop measures to calcaulate Types: "1 only", "2 only"  or a "1 AND 2"

 

I have used the following measures to determine # of Type "1 only" (hopefully the values are correct), but struggling to get the "1 AND 2" to work.

TYPE1 ONLY:

 

 

CALCULATE(
  COUNTAX(TableB,TableB[GUID],
  DISTINCT(TableB[GUID]),
  FILTER(TableB,TableB[type]=1)
  )

 

 

I used the same formula above for 2 only by changing the the filter to Type = 2

 

However when trying to do this for Both, I get an Zero results (which I know to be incorrect) I was trying:

 

CALCULATE(
  COUNTAX(TableB,TableB[GUID],
  DISTINCT(TableB[GUID]),
  FILTER(TableB,TableB[type]=1),
FILTER(TableB,TableB[type]=2)
)

 

I have also tried combinations of FILTER as 

FILTER(TableB,TableB[type]=1 && TableB[type]=2) which does not seem to work...

 

Any suggestion as to where I am maybe going wrong? 

 

Thanks in advance.

 

 

 

 

 


Viewing all articles
Browse latest Browse all 217217

Trending Articles



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