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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
A_a_a
Helper III
Helper III

Joining two variables to get correct row and column totals

Hi All,

 

I created a measure with two variables, which should provide correct totals for rows and for columns in Matrix Table.

Rows show products(dim_a [a]), Columns show weeks (dim_b[b]).

 

When I use ‘var a’, it works correctly for column total, if ‘var b’ for row total.

I have no idea how to join them in Return to see correct totals in rows and columns at the same time.

Measure =

var a =CALCULATE(IF(COUNTROWS(VALUES(dim_a[a]))=1,[Measure V1],sumx(values(dim_a[a]),[Measure V1])))

 

var b = CALCULATE(IF(COUNTROWS(VALUES(dim_b[b]))=1,[Measure V1],sumx(values(dim_b[b]),[Measure V1])))

 

Return ??

 

 

Please support. Thank you.

2 REPLIES 2
amitchandak
Super User
Super User

@A_a_a , Try like

 

Measure =

var a= sumx(filter(values(dim_a[a]),COUNTROWS(VALUES(dim_a[a]))=1 ),[Measure V1])
var b= sumx(filter(values(dim_b[b]),COUNTROWS(VALUES(dim_b[b]))=1 ),[Measure V1])

return
a+b

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi @amitchandak 

 

Thank you.

Unfortunately, it is not working.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.