Forum Discussion
Dynamic sumx () specific vales from a table
- 4 years ago
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
Thanks,
That section has already been covered.
CALCULATE(sumx('table','table'[RONACALLS]),fltr_Qtr,fltr_Weekday_flag,fltr_subregion_shift, FILTER(VALUES('table'),'table'[SubRegion] = "NA"))
- AllisonKennedy4 years agoCommunity Champion
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.
- perezco4 years agoAdvocate III
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.- AllisonKennedy4 years agoCommunity Champion
perezco Could you add a column for 'Quarter' that filters which conditions should be used each quarter?