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
Anonymous
Not applicable

Sum an existing measure in matrix per row

Hi!

 

I'm been dealing with an issue for a while that I am not able to solve. I have a matrix with 1 row, 1 column and 1 Value (the value is a measure) like below (image1). What I am trying to do is add an additional measure that basically checks if any value in the row has 1. If so, then I want to whole row to get the value 1 (see image 2). I've been looking into MAXX and SUMX but it is not working. Are there any other solution I can look into?

 

image1

 USACANMEX
A101
B000
C011

 

image2

 USACANMEX
A111
B000
C111
1 ACCEPTED SOLUTION
v-yueyunzh-msft
Community Support
Community Support

Hi , @Anonymous 

Thanks for your sample data and detailed description.

Here are the steps you can refer to :
(1)This is my test data:

vyueyunzhmsft_0-1689212781897.png

(2)I create a measure to simulate your situation:

Measure = SUM('Table'[Value])
vyueyunzhmsft_1-1689212823158.png

(3)Then we can create the measure like this:

Measure 2 = var _t =ADDCOLUMNS( CROSSJOIN( VALUES('Table'[Row]) , ALLSELECTED('Table'[Column])) , "m" , [Measure])
return
IF(SUMX(_t,[m])>0,1,0)

 

Then we can put this measure on the visual and we can get the result as follows:

vyueyunzhmsft_2-1689212858953.png

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

View solution in original post

3 REPLIES 3
v-yueyunzh-msft
Community Support
Community Support

Hi , @Anonymous 

Thanks for your sample data and detailed description.

Here are the steps you can refer to :
(1)This is my test data:

vyueyunzhmsft_0-1689212781897.png

(2)I create a measure to simulate your situation:

Measure = SUM('Table'[Value])
vyueyunzhmsft_1-1689212823158.png

(3)Then we can create the measure like this:

Measure 2 = var _t =ADDCOLUMNS( CROSSJOIN( VALUES('Table'[Row]) , ALLSELECTED('Table'[Column])) , "m" , [Measure])
return
IF(SUMX(_t,[m])>0,1,0)

 

Then we can put this measure on the visual and we can get the result as follows:

vyueyunzhmsft_2-1689212858953.png

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

Anonymous
Not applicable

Thank you! This worked after a small modification 🙂

Measure 2 = var _t =ADDCOLUMNS( CROSSJOIN( ALLSELECTED('Table'[Row]) , ALLSELECTED('Table'[Column])) , "m" , [Measure])
return
IF(SUMX(_t,[m])>0,1,0)

Sahir_Maharaj
Super User
Super User

Hello @Anonymous,

 

Can you please try:

NewMeasure = IF(MAX('YourTable'[Value]) = 1, 1, 0)

Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

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.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.