Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi all,
How can I have a dax sumx() function that only sums specific values with specific characteristics?
Desire to have
| I'm attempting to have a dynamic sumx() function where only sums data that have specific characteristic. The SubRegion_shift can be changing by month.
|
Current result
| Ronas= sumx('Fact - Tbl.all.SMALL, 'Fact - Tbl.all.SMALL'[RONAS]) acd= sumx('Fact - Tbl.all.SMALL, 'Fact - Tbl.all.SMALL'[acd]) |
Data example
|
|
regards |
|
Solved! Go to Solution.
For my particular circumstance, I decided to add an extra column to the query by adding a line of multiple CASE WHEN functions to the sql query.
@perezco I haven't read all your conditions, so just hoping to provide you the idea that you can apply to your own data:
SUMX ( FILTER ( TableName, TableName[Column1] = "Condition1" && TableName[Column2] = "Condition 2") , TableName[ColumnToSum] )
If your conditions change from month to month, are you able to create a mapping table or another column that uses those conditions to flag whether to include the row yes or no in the SUMX, then use that flag column in your FILTER condition.
You may also be interested in using an OR filter which is || in Power BII:
https://excelwithallison.blogspot.com/2021/09/advanced-filter-or-vs-and.html
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
Thanks,
That section has already been covered.
@perezco If that's already covered, then what is your question exactly?
The excel table with the conditions, if you can make that more tabular database friendly. For example a column with all the values in your IN {{value1, value2}} conditions, each value needs to be its own cell in the same column. Then you can use DAX VALUES() function and the IN operator in DAX to create those conditions and make them dynamic by getting your raw data condition table set up properly.
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
The idea does not appear to be a bad one.
I can do it in the backstage using sql or in the power query editor.
The disadvantage is that this report will require human intervention every time the quarter changes...because the fltr_Qtr for either of the two possibilities will be manual.
@perezco Could you add a column for 'Quarter' that filters which conditions should be used each quarter?
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
Your intervention has made it much easier for me to see things in a more straightforward manner.😁
yes. I have the 'Quarter' column part of this fact table. 👍
@perezco Glad the fog is clearing and it's getting easier - what questions do you still have outstanding? Or can we mark this post as solved?
Feel free to write up a summary of what you did and mark your own post as the solution if that makes the most sense. 🙂
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
For my particular circumstance, I decided to add an extra column to the query by adding a line of multiple CASE WHEN functions to the sql query.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 59 | |
| 46 | |
| 42 | |
| 23 | |
| 18 |
| User | Count |
|---|---|
| 193 | |
| 123 | |
| 99 | |
| 67 | |
| 49 |