Forum Discussion
Compare two Columns
- 6 years ago
Hi jp5481 ,
You can modify Greg_Deckler 's DAX expression like this:
Table 10 = VAR __table = GENERATEALL ( DISTINCT ( SELECTCOLUMNS ( 'Table', "__customer", [Customers] ) ), DISTINCT ( SELECTCOLUMNS ( 'Table', "__product", [Products] ) ) ) VAR __table1 = ADDCOLUMNS ( __table, "number", COUNTROWS ( FILTER ( 'Table', [Products] = [__product] && [Customers] = [__customer] ) ) ) RETURN __tableBest Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Here is a DAX table expression for it:
Table 10 =
VAR __table = GENERATEALL(DISTINCT(SELECTCOLUMNS('Table 9',"__product",[Products])),DISTINCT(SELECTCOLUMNS('Table 9',"__customer",[Customers])))
VAR __table1 = ADDCOLUMNS(__table,"number",COUNTROWS(FILTER('Table 9',[Products]=[__product] && [Customers]=[__customer])))
RETURN
__table1
Greg_Deckler wrote:Here is a DAX table expression for it:
Table 10 = VAR __table = GENERATEALL(DISTINCT(SELECTCOLUMNS('Table 9',"__product",[Products])),DISTINCT(SELECTCOLUMNS('Table 9',"__customer",[Customers]))) VAR __table1 = ADDCOLUMNS(__table,"number",COUNTROWS(FILTER('Table 9',[Products]=[__product] && [Customers]=[__customer]))) RETURN __table1
You are correct. This expression produces the intended results. However, what I was hoping to get was a result that only displayed customers who purchased multiple products, along with a list of the products they purchased. I don't know how to ask that question properly.
- Icey6 years agoCommunity Support
Hi jp5481 ,
You can modify Greg_Deckler 's DAX expression like this:
Table 10 = VAR __table = GENERATEALL ( DISTINCT ( SELECTCOLUMNS ( 'Table', "__customer", [Customers] ) ), DISTINCT ( SELECTCOLUMNS ( 'Table', "__product", [Products] ) ) ) VAR __table1 = ADDCOLUMNS ( __table, "number", COUNTROWS ( FILTER ( 'Table', [Products] = [__product] && [Customers] = [__customer] ) ) ) RETURN __tableBest Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.