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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Sagejah9
Helper III
Helper III

How to add a calculated measure to a row thats exist in a matrix

I am creating a PNL financial report using a visual Matrix. In one table I have month, amount ($), group and subgroup

 

how can I use DAX to insert a calculation in one of the groups that requires using totals from the above group values. For Example , total revenue and total expense to get gross profit. I tried using a switch case to allocate the measure to the line but getting blanks. Help please?!

Sagejah9_0-1612122724147.png

 

I am Expecting a matrix table to look like this :

Sagejah9_0-1612127970840.png

Measures:
Total Revenue = CALCULATE(SUM('Table1'[Amount]),'Table1'[GroupName] ="Revenue")
Total Expenses = CALCULATE(SUM('Table1'[Amount]),'Table1'[GroupName] ="Expenses")
Net Profit = [Total Revenue] - [Total Expenses]

Values_Measure = SWITCH(SELECTEDVALUE('Table1'[GroupName]), "Profit Before Tax", [Net Profit], CALCULATE(SUM('Table1'[Amount]))

 

@Pragati11 

 

2 REPLIES 2
v-janeyg-msft
Community Support
Community Support

Hi, @Sagejah9 

 

Have your problem been solved? If not,Can you share some sample fake data? So we can help you soon.

 

Best Regards

Janey Guo

Pragati11
Super User
Super User

Hi @Sagejah9 ,

 

Please refer this link first to know how to get your query answered as you haven't provided much details:

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors