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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
muhammad_bens
Regular Visitor

Issue with Displaying Correct Values in Matrix Visualization for Grouped Items

Hi Community,

I need help with a matrix visualization in Power BI. My dataset includes items grouped under "Crop" which contains "Area_planted" and "Crop_yield." I want to show a ratio (Area_planted / Crop_yield) for the "Crop" group, but display the actual values for "Area_planted" and "Crop_yield" items.

Here is the measure I’m using for the ratio:

```dax
Crop Ratio =
DIVIDE(
CALCULATE(
SUM('balance_sheet'[Value]),
'balance_sheet'[Items] = "Area_planted"
),
CALCULATE(
SUM('balance_sheet'[Value]),
'balance_sheet'[Items] = "Crop_yield"
),
0
)
And here is the measure to display values in the matrix:
TheTableMeasure =
IF(
SELECTEDVALUE('balance_sheet'[Items (groups)]) = "Crop",
[Crop Ratio],
[Actual Value Measure]
)

However, when I apply this, the "Area_planted" and "Crop_yield" rows show the same ratio value as the "Crop" group, instead of their actual values. How can I display the ratio only for the "Crop" group and the actual values for "Area_planted" and "Crop_yield"?

Thanks for your help!

muhammad_bens_0-1719795481260.png

 




5 REPLIES 5
Anonymous
Not applicable

Hi @muhammad_bens ,

Whether your problem has been resolved? If no, please update the formula of measure [Measurement table] as below and check if it can return the expected result...

Measurement table =
IF (
    ISINSCOPE ( 'Balance'[Articles(Collections)] ),
    IF (
        SELECTEDVALUE ( 'Balance'[Articles(Collections)] ) = 'Crop',
        [harvest report],
        [Actual value measurement]
    )
)

 

If the above one can't help you get the expected result, please provide some raw data in your tables(exclude sensitive data) with Text format and your expected result with backend logic and special examples. It would be helpful to find out the solution. You can refer the following link to share the required info:

How to provide sample data in the Power BI Forum

 

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

muhammad_bens
Regular Visitor

Thank you aduguid for replying to my message. I had to make some changes to your code due to a context error, and this is the result:
Measurement table =
if (
ISINSCOPE('Balance'[Articles(Collections)]) && SELECTEDVALUE('Balance'[Articles(Collections)]) = 'Crop',
[harvest report],
[Actual value measurement]
)
It always shows the same result 😞

Rakesh1705
Super User
Super User

Pls let us know if the carry out group also contains area planted and crop yield data ?

thanks Rakesh for responding , no , carry out do not contains area planted and crop yield 

muhammad_bens_0-1719928098514.png

 

aduguid
Super User
Super User

Give this a try using INSCOPE

 

TheTableMeasure =
	IF (
		ISINSCOPE ( 'balance_sheet'[Items (groups)] ) && 'balance_sheet'[Items (groups)] = "Crop",
		[Crop Ratio],
		[Actual Value Measure]
	)

 

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.