Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi,
I have a table of multiple columns that I will like to display showing all possible combinations of those values. Does anyone has an easy solution? Below a simple example of what I am trying to resolve. Thank you.
Solved! Go to Solution.
Hi @Aleph18
Create a new table, where Table1 is the original table you show on the left:
NewTable = VAR AuxTable_ = CROSSJOIN ( DISTINCT ( Table1[Product] ); DISTINCT ( Table1[Type] ) ) RETURN ADDCOLUMNS ( AuxTable_; "Quantity"; LOOKUPVALUE ( Table1[Quantity]; Table1[Product]; [Product]; Table1[Type]; [Type] ) )
You can use this DAX, though I always prefer to do this type of thing in Power Query:
Table 2 = ADDCOLUMNS( CROSSJOIN( SELECTCOLUMNS('Table', "Type",'Table'[Type]), SELECTCOLUMNS('Table',"Product",'Table'[Product] ) ), "Quantity", CALCULATE( SUM( 'Table'[Qty])))
You can use this DAX, though I always prefer to do this type of thing in Power Query:
Table 2 = ADDCOLUMNS( CROSSJOIN( SELECTCOLUMNS('Table', "Type",'Table'[Type]), SELECTCOLUMNS('Table',"Product",'Table'[Product] ) ), "Quantity", CALCULATE( SUM( 'Table'[Qty])))
Hi @Aleph18
Create a new table, where Table1 is the original table you show on the left:
NewTable = VAR AuxTable_ = CROSSJOIN ( DISTINCT ( Table1[Product] ); DISTINCT ( Table1[Type] ) ) RETURN ADDCOLUMNS ( AuxTable_; "Quantity"; LOOKUPVALUE ( Table1[Quantity]; Table1[Product]; [Product]; Table1[Type]; [Type] ) )
User | Count |
---|---|
84 | |
75 | |
63 | |
51 | |
45 |
User | Count |
---|---|
101 | |
43 | |
39 | |
39 | |
36 |