Forum Discussion
Calculating percent based on values appearing in another column (PowerPivot)
It sounds like you want to create Power BI measures that involve conditional calculations based on values in different tables. Here is how you can approach these two measures:
- Display Values from Table B Based on Table A:
To display values from Table B (column F) only if the Pivot is displaying values from Table A (column D), you can use the following DAX measure:
FilteredValues = CALCULATE( MAX('Table B'[Column F]), 'Table A'[Column D] = SELECTEDVALUE('Table A'[Column D]) )
In this measure, 'Table B'[Column F] is filtered based on the value selected in 'Table A'[Column D].
- Calculate Percentage of Row Amount to Total Amount:
To calculate the percentage of the amount in the row compared to the total amount in the first measure, you can use the following DAX measure:
PercentageOfTotal = DIVIDE( [FilteredValues], SUM('Table B'[Column F]), BLANK() )
In this measure, [FilteredValues] is the measure you calculated in the first step. SUM('Table B'[Column F]) calculates the total amount from Table B. The DIVIDE function calculates the percentage, and BLANK() handles scenarios where the total amount is zero.
Remember to replace 'Table A'[Column D], 'Table B'[Column F], 'Table B', and any other column/table names with your actual column/table names.
Apply these measures in your Power Pivot data model, and they should provide you with the desired results. Remember that Power BI measures work based on context, so their behavior might vary depending on the context in which they are displayed.
Since no one has answered it for at least one day, I entered your question in various AI. The text and the steps were created with the help of AI.
My answers are voluntary and without guarantee!
Hope this will help you.