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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
v-tangjie-msft
Community Support
Community Support

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
v-tangjie-msft
Community Support
Community Support

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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