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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
mahaboobpathan
Regular Visitor

How to build Key table

Hi

I have table like this below and would like to get the key values or totals of each in seperate table 

 

TLNameproductcount
Aabc0
Acba0
Asdf1
Asgdg0
Brsdf1
Buiyuiu1
Brwe0
Byiuy1
Cmnbmn1
Couio1
Ctetr1

 

Need total table like this

TLNameproductcountpercentage
A4125%
B4250%
C33100%

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @mahaboobpathan ,

 

According to your description, here are my steps you can follow as a solution.

(1) My test data is the same as yours.

(2) We can create a table.

Table 2 =
DISTINCT (
    SELECTCOLUMNS (
        'Table',
        "TLName", 'Table'[TLName],
        "product", COUNTROWS ( FILTER ( 'Table', 'Table'[TLName] = EARLIER ( 'Table'[TLName] ) ) ),
        "count",
            CALCULATE (
                SUM ( 'Table'[count] ),
                FILTER ( 'Table', 'Table'[TLName] = EARLIER ( 'Table'[TLName] ) )
            ),
        "percentage",
            DIVIDE (
                CALCULATE (
                    SUM ( 'Table'[count] ),
                    FILTER ( 'Table', 'Table'[TLName] = EARLIER ( 'Table'[TLName] ) )
                ),
                COUNTROWS ( FILTER ( 'Table', 'Table'[TLName] = EARLIER ( 'Table'[TLName] ) ) ),
                0
            )
    )
)

(3) Then the result is as follows.

vtangjiemsft_0-1678935436569.png

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @mahaboobpathan ,

 

According to your description, here are my steps you can follow as a solution.

(1) My test data is the same as yours.

(2) We can create a table.

Table 2 =
DISTINCT (
    SELECTCOLUMNS (
        'Table',
        "TLName", 'Table'[TLName],
        "product", COUNTROWS ( FILTER ( 'Table', 'Table'[TLName] = EARLIER ( 'Table'[TLName] ) ) ),
        "count",
            CALCULATE (
                SUM ( 'Table'[count] ),
                FILTER ( 'Table', 'Table'[TLName] = EARLIER ( 'Table'[TLName] ) )
            ),
        "percentage",
            DIVIDE (
                CALCULATE (
                    SUM ( 'Table'[count] ),
                    FILTER ( 'Table', 'Table'[TLName] = EARLIER ( 'Table'[TLName] ) )
                ),
                COUNTROWS ( FILTER ( 'Table', 'Table'[TLName] = EARLIER ( 'Table'[TLName] ) ) ),
                0
            )
    )
)

(3) Then the result is as follows.

vtangjiemsft_0-1678935436569.png

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.