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
Raul
Post Patron
Post Patron

Total different according to a condition

Hello community.

I have a matrix where I present by rows the Year and Month of the calendar table and I have also a segmenter by Customer. I want to create a measure that returns the sum of the column Total1 of the table RESULTS if the customer code of that table is equal to 150 or that returns the sum of the column Total1 of the table COMPARISON otherwise.

The CALENDAR and CUSTOMER tables are related to the RESULTS and COMPARISON tables.

What would be the DAX expression of the measure?
Thank you

1 ACCEPTED SOLUTION
Daniel29195
Super User
Super User

@Raul 

 

 

use the following measue : 

 

measure = 
sumx( 

values(customer[customer_code]),

switch(

true(), 

customer[customer_code] = 150 ,  calculate ( sum(results[total1]),

calculate ( sum(comparison[total1]))
)
)

 

 

let me know if this works for you . 

 

 

 

If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠

 

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

Share data in a format that can be pasted in an MS Excel file and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Daniel29195
Super User
Super User

@Raul 

 

 

use the following measue : 

 

measure = 
sumx( 

values(customer[customer_code]),

switch(

true(), 

customer[customer_code] = 150 ,  calculate ( sum(results[total1]),

calculate ( sum(comparison[total1]))
)
)

 

 

let me know if this works for you . 

 

 

 

If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠

 

Thank you @Daniel29195 for your post.

This solution doesn't work in my case because I had to add some other condition but it has helped me to see how to build the measure I needed.

 

Thank you very much.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

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

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.