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

ADDCOLUMNS and actual values return (e.g. text string)

$
0
0

 

Greetings:

 

I have a question for the Community as follows:

 

Background:

 

I used an INTERSECT() to generate a single column table that is a return of distinct values of "Type A" that are common between Table 1 and Table 3.  Now I wish to generate an additional (extended) column using ADDCOLUMNS() to return all values of "Type B" from Table 2, which match the "Type A" values returned in the first column via INTERSECT() statement.  Note that Table 2 contains "Type A" and "Type B" values (so there is a granularity transition there.)

 

Since ADDCOLUMNS() is an iterator, I am able to wrap the ADDCOLUMNS() expression argument in CALCULATETABLE which in turn is wrapped by an Iterator function (e.g. COUNTROWS() to return e.g. an accurate count of "Type B" values matching each "Type A" value.  But, how might one go about returning the mathing "Type B" values (text) as opposed to -in this example- a count thereof?

 

Example Measure =

Part 1 - return single column table containing common "Type A" values btw Tables 1 and 3:

INTERSECT(DISTINCT(Table1[Type A Values]),DISTINCT(Table 3[Type A Values]))

 

Part 2 - return count of mathing "Type B" values (for each "Type A" value in the above resulting column):

 

ADDCOLUMNS(Part 1 expression),"Cnt of Matching Type B Values",COUNTROWS(CALCULATETABLE(DISTINCT(Table 2[Type B Values])

 

Entire expression:

 

ADDCOLUMNS(INTERSECT(DISTINCT(Table1[Type A Values]),DISTINCT(Table 3[Type B Values])),"Cnt of Matching Type B Values",COUNTROWS(CALCULATETABLE(DISTINCT(Table 2[Type B Values])

 

Again, the second column in the resulting virtual table ("Cnt of Mathing Type B Values") populates accurate counts of matching "Type B" values.  The question is how might one go about actually returning all of the mathing "Type B" values -for each "Type A" value, as opposed to merely their count?

 

Notes:

* I udnerstand same result for part 1 could be obtained via CALCULATETABLE(DISTINCT(Table 2[Type A Values]),RELATEDTABLE(Table 1),RELATEDTABLE(Table 2)) - let me know if you think this is a better solution and the reasons why.

* My problem in reality is a bit more complex in that it involves additional transitions in data granularity via additional lookup tables and fact tables but if I can get assistance with resolving the above example - that is how does one get ADDCOLUMNS() to return actual values which correspond to an adjacent column generated by it's <Table> argument- I should be able to apply the concept more broadly.

* I've tried IF(COUNTROWS(DISTINCT(Table 2[Type B Values]))>1,BLANK(),DISTINCT(Table 2[Type B Values])) but no cigar...

 

Let me know if you have any thoughts.  Thanks in advance!

 

Igor

 

Sample from actual data set (involves an additional set of values - say "Type C")

Needs ItemMathing EDLsMatching Rev.0 Dwgs

59270
65223
1355155
155a321
161a1143
197231
213168
21717
717
8318
108105
12553
1648324
17553
19325
20223
2919
903157
913157
923154
933168
943157
953168
963157
1025155
1035155
1045155
1055155
1075155
1611143
17011
1752250
17625
17722
17822
1935281
206321
6223
44370
45270
48270
631143
643169
69114
7047
736275
746275
756275
796275
876283
885281
140a5281
141325
1425281
1463268
15028
15219
153325
15526
15919

Viewing all articles
Browse latest Browse all 217157

Trending Articles



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