Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Aleph18
Frequent Visitor

Display table with all possible combination of columns values

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.

Capture.PNG

 

2 ACCEPTED SOLUTIONS
AlB
Community Champion
Community Champion

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]
        )
    )

View solution in original post

Anonymous
Not applicable

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])))

Crossjoin Example.png

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

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])))

Crossjoin Example.png

AlB
Community Champion
Community Champion

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]
        )
    )

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.