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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.