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
Anonymous
Not applicable

Card percentage of total sum - 2 different tables

Hi - I have 2 tables... Table A and Table B.

 

I want to find the percentage of the grand total from a field in Table A let's call it "Class". Class has 3 options "1, 2, or 3".

 

Table B has the actual dollar amounts let's call it "sum total value" that relate to table based on a common field.

 

I know about the calculate function, but I'm not sure how to do this formula since the data is coming from 2 tables.

 

I have the following so far:

 

Measure 1 =
DIVIDE (
SUM ( Table A  [Sum Total Value] ),
CALCULATE ( SUM ( TABLE A[Sum Total Value] ), ALLSELECTED ( TABLE B [CLASS] = '1') )
)
1 REPLY 1
v-lionel-msft
Community Support
Community Support

Hi @Anonymous ,

 

I want to find the percentage of the grand total from a field in Table A let's call it "Class". Class has 3 options "1, 2, or 3".

“Table B has the actual dollar amounts let's call it "sum total value" that relate to table based on a common field.”

b2.png

 

I’m not sure what’s your data model.

Which column do the two tables use to connect with each other?

Is the [Sum total value] column a DAX column?

Is it like this?

b3.png

I had created such a measure and add it into a card:

 

 

 

Percentage1 = 
DIVIDE(
    SUMX(
        FILTER(
            TableB,
            TableB[Class] = 1
        ),
        RELATED(TableA[Sum total value])
    ),
    SUM(TableA[Sum total value])
)

 

 

b4.png


Or you can do like this:

 

 

Measure = 
IF(
    ISFILTERED(TableB[Class]),
    DIVIDE(
    SUM(TableA[Sum total value]),
    SUMX(
        ALLEXCEPT(
            TableB,
            TableB[Class]
        ),
        RELATED(TableA[Sum total value])
    )
    ),
    BLANK()
)

 

 

b5.png

 

If they’re not what you want, please give me a sample data model, and tell me what visualization do you ultimately want to achieve.

If it is sloved, could you kindly accept it as a solution to close this case?

If not, please let me know.

 

Best regards,
Lionel Chen

 

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.