Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Ok I have a very complicated DAX formula that I would like to optimize. Just to be clear, I may use the word Sample in place of Denominator, but I am essentially referring to the same thing.
2 Fact Tables (1 to many relationship with bi-directional cross filtering):
There are 100's of different types forms, numerators, and denominators being submitted
1 Dim Table (1 to many relationship with FormSubmitItems with bi-directional cross filtering)
Not every numerator has a denominator, and therefore should be divided by 1 or the # of forms for the numerator e.g. FormCount
Some forms have 2 denominators or subgroups indicated by the FormSubGroup, where 1 sub group of numerators is associated with 1 denominator, and another sub group of numerators is associated with the other denominator.
There is also 1 other special scenario: some of the denominators have a special multiplier indication by user via a dropdown called the UnitType.
So to put this all together:
I currently am calculating as shown below by the formula
Then to put it all together
Since the calculation/filter context needs to be performed at the subgroup level I must use a SUMX per SubGroup of FormSubmitItems nested in another SUMX per Form Submition - FormSubmitID. Or at least that is the only thing I could get to work for these fact tables as I am working at that level of filter context and....
This allows the user to see the score by one or more FormItems that may have different denominators and the filter context will appropriately weight the score across the board where needed either at the granular per Item level or as an overall system wide score.
Performance is not scaling well, Help! 🙂
DAX formula below
The bi-directional cross filtering mentioned before is a must for the user to be able to see all levels of granularity and just does not calculate correctly and does not help performance if i cut off. I've tried just using it at the measure level but that does not help either as I just end up having to add to too many measures any way. So guessing it has more to do with the nested SumX and multiple Calculate function and hoping there is a better way. I will continue to think through and will post if I come up with anything, but any help would be greatly appreciated.
SampleSize =
SUMX(DISTINCT(FormSubmit[FormSubmitID]),
VAR RelatedFormSubmitItem = SUMX(DISTINCT(FormSubmitItems[FormSKFormSubGroupIndex]),
VAR EvaluateFormSample = CALCULATE(SUM(FormSubmitItems[Value]),ALLEXCEPT(FormItemCategories,FormItemCategories[FormID]),FormItemCategories[Input]="Denominator",FormItemCategories[Override]=0)
VAR EvaluateFormSubGroupSample = CALCULATE(SUM(FormSubmitItems[Value]),ALLEXCEPT(FormItemCategories,FormItemCategories[FormSubGroup]),FormItemCategories[Input]="Denominator",FormItemCategories[Override]=0)
VAR EvaluateUnitTypeSample = CALCULATE(MAX(DimFormItemPicker[IDValue]),ALLEXCEPT(FormItemCategories,FormItemCategories[FormID]),FormSubmitItems[InputType]=3)
VAR EvaluateSample = SWITCH(BLANK(),EvaluateFormSubGroupSample,EvaluateFormSample,EvaluateFormSubGroupSample)
VAR Sample = SWITCH(BLANK(),EvaluateUnitTypeSample,EvaluateSample,EvaluateSample*EvaluateUnitTypeSample)
VAR FormCount = CALCULATE(SUM(FormSubmit[FormSubmitCount]),ALLEXCEPT(FormItemCategories,FormItemCategories[FormID]))
Return
SWITCH(BLANK(),Sample,FormCount,Sample))
Return
RelatedFormSubmitItem)
@jwademcg,
Please share sample data of your tables so that we can test.
Regards,
Lydia
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.