Forum Discussion
powerbihelp87
6 years agoHelper V
Help with DAX for SumX and Filter function on multiple columns
I need to calculate the sum of two columns based on filters. I tried: SUMX(FILTER('Test Table','Test Table'[Code="10023" || 'Test Table'[Code]="10039" && 'Test Table'[Category]="az" && 'Test Tabl...
- 6 years ago
Try this:
= SUMX ( FILTER ( ALLSELECTED ( 'Test Table' ), ( 'Test Table'[Code] = "10023" || 'Test Table'[Code] = "10039" ) && ( 'Test Table'[Category] = "az" || 'Test Table'[Category] = "ac" ) ), 'Test Table'[ Amount] )
AntrikshSharma
6 years agoCommunity Champion
Try this:
=
SUMX (
FILTER (
ALLSELECTED ( 'Test Table' ),
( 'Test Table'[Code] = "10023"
|| 'Test Table'[Code] = "10039" )
&& ( 'Test Table'[Category] = "az"
|| 'Test Table'[Category] = "ac" )
),
'Test Table'[ Amount]
)
- powerbihelp876 years agoHelper V
Amazing! Thank you so much I was mixing up the && || and didn't include ALL!
thank you!!!!!
- powerbihelp876 years agoHelper V
AntrikshSharma actually it works at total level and when I want to filter. But if I add a filter like plant into a table it shows total and won't break it down unless i filter. but once i filter on lets say C01 the numbers appear?
once i filter numbers break down properly. I think i solved this by removing the ALLSELECTED
- AntrikshSharma6 years agoCommunity Champion
Cool, I thought you wanted total for the conditions plus anything that is selected through slicers.
- powerbihelp876 years agoHelper V
AntrikshSharma Yes, you are right initially I did but then realized I need to see more data. thanks!