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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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

Hi @amitchandak 

 

Thank you.

Unfortunately, it is not working.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.